mirror of
https://github.com/unidoc/unipdf.git
synced 2025-05-05 19:30:30 +08:00
12 lines
3.8 KiB
Go
12 lines
3.8 KiB
Go
//
|
|
// Copyright 2020 FoxyUtils ehf. All rights reserved.
|
|
//
|
|
// This is a commercial product and requires a license to operate.
|
|
// A trial license can be obtained at https://unidoc.io
|
|
//
|
|
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
|
|
//
|
|
// Use of this source code is governed by the UniDoc End User License Agreement
|
|
// terms that can be accessed at https://unidoc.io/eula/
|
|
|
|
package basic ;import _a "github.com/unidoc/unipdf/v3/internal/jbig2/errors";func (_cc *NumSlice )Add (v float32 ){*_cc =append (*_cc ,v )};func Sign (v float32 )float32 {if v >=0.0{return 1.0;};return -1.0;};func (_aff NumSlice )GetIntSlice ()[]int {_fb :=make ([]int ,len (_aff ));for _fbc ,_cee :=range _aff {_fb [_fbc ]=int (_cee );};return _fb ;};func (_dgg *Stack )peek ()(interface{},bool ){_fad :=_dgg .top ();if _fad ==-1{return nil ,false ;};return _dgg .Data [_fad ],true ;};func (_c IntsMap )Add (key uint64 ,value int ){_c [key ]=append (_c [key ],value )};func (_da *Stack )Peek ()(_e interface{},_eb bool ){return _da .peek ()};func Max (x ,y int )int {if x > y {return x ;};return y ;};type IntsMap map[uint64 ][]int ;func NewIntSlice (i int )*IntSlice {_gg :=IntSlice (make ([]int ,i ));return &_gg };type NumSlice []float32 ;func Abs (v int )int {if v > 0{return v ;};return -v ;};func (_f IntsMap )Get (key uint64 )(int ,bool ){_ag ,_ce :=_f [key ];if !_ce {return 0,false ;};if len (_ag )==0{return 0,false ;};return _ag [0],true ;};func (_gd IntSlice )Get (index int )(int ,error ){if index > len (_gd )-1{return 0,_a .Errorf ("\u0049\u006e\u0074S\u006c\u0069\u0063\u0065\u002e\u0047\u0065\u0074","\u0069\u006e\u0064\u0065x:\u0020\u0025\u0064\u0020\u006f\u0075\u0074\u0020\u006f\u0066\u0020\u0072\u0061\u006eg\u0065",index );};return _gd [index ],nil ;};func (_fe IntSlice )Size ()int {return len (_fe )};func (_dg NumSlice )GetInt (i int )(int ,error ){const _bf ="\u0047\u0065\u0074\u0049\u006e\u0074";if i < 0||i > len (_dg )-1{return 0,_a .Errorf (_bf ,"\u0069n\u0064\u0065\u0078\u003a\u0020\u0027\u0025\u0064\u0027\u0020\u006fu\u0074\u0020\u006f\u0066\u0020\u0072\u0061\u006e\u0067\u0065",i );};_af :=_dg [i ];return int (_af +Sign (_af )*0.5),nil ;};func (_gde *Stack )top ()int {return len (_gde .Data )-1};func (_b *IntSlice )Copy ()*IntSlice {_db :=IntSlice (make ([]int ,len (*_b )));copy (_db ,*_b );return &_db ;};func NewNumSlice (i int )*NumSlice {_be :=NumSlice (make ([]float32 ,i ));return &_be };func (_ac IntsMap )Delete (key uint64 ){delete (_ac ,key )};func Min (x ,y int )int {if x < y {return x ;};return y ;};func (_dd *Stack )Pop ()(_cf interface{},_fbd bool ){_cf ,_fbd =_dd .peek ();if !_fbd {return nil ,_fbd ;};_dd .Data =_dd .Data [:_dd .top ()];return _cf ,true ;};func (_gb *NumSlice )AddInt (v int ){*_gb =append (*_gb ,float32 (v ))};func (_fa IntsMap )GetSlice (key uint64 )([]int ,bool ){_d ,_dc :=_fa [key ];if !_dc {return nil ,false ;};return _d ,true ;};func (_gbg NumSlice )Get (i int )(float32 ,error ){if i < 0||i > len (_gbg )-1{return 0,_a .Errorf ("\u004e\u0075\u006dS\u006c\u0069\u0063\u0065\u002e\u0047\u0065\u0074","\u0069n\u0064\u0065\u0078\u003a\u0020\u0027\u0025\u0064\u0027\u0020\u006fu\u0074\u0020\u006f\u0066\u0020\u0072\u0061\u006e\u0067\u0065",i );};return _gbg [i ],nil ;};func Ceil (numerator ,denominator int )int {if numerator %denominator ==0{return numerator /denominator ;};return (numerator /denominator )+1;};func (_gf *Stack )Push (v interface{}){_gf .Data =append (_gf .Data ,v )};type Stack struct{Data []interface{};Aux *Stack ;};func (_fec *Stack )Len ()int {return len (_fec .Data )};type IntSlice []int ;func (_ab *IntSlice )Add (v int )error {if _ab ==nil {return _a .Error ("\u0049\u006e\u0074S\u006c\u0069\u0063\u0065\u002e\u0041\u0064\u0064","\u0073\u006c\u0069\u0063\u0065\u0020\u006e\u006f\u0074\u0020\u0064\u0065f\u0069\u006e\u0065\u0064");};*_ab =append (*_ab ,v );return nil ;}; |