mirror of
https://github.com/unidoc/unipdf.git
synced 2025-05-07 19:29:16 +08:00
24 lines
3.8 KiB
Go
24 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 _e "github.com/unidoc/unipdf/v3/internal/jbig2/errors";func (_cb *Stack )Len ()int {return len (_cb .Data )};func (_ge NumSlice )GetIntSlice ()[]int {_fg :=make ([]int ,len (_ge ));for _aaa ,_ba :=range _ge {_fg [_aaa ]=int (_ba );
|
|
};return _fg ;};func (_ee *IntSlice )Copy ()*IntSlice {_de :=IntSlice (make ([]int ,len (*_ee )));copy (_de ,*_ee );return &_de ;};type NumSlice []float32 ;func (_be NumSlice )GetInt (i int )(int ,error ){const _gb ="\u0047\u0065\u0074\u0049\u006e\u0074";
|
|
if i < 0||i > len (_be )-1{return 0,_e .Errorf (_gb ,"\u0069n\u0064\u0065\u0078\u003a\u0020\u0027\u0025\u0064\u0027\u0020\u006fu\u0074\u0020\u006f\u0066\u0020\u0072\u0061\u006e\u0067\u0065",i );};_ece :=_be [i ];return int (_ece +Sign (_ece )*0.5),nil ;
|
|
};func (_ad IntSlice )Get (index int )(int ,error ){if index > len (_ad )-1{return 0,_e .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 _ad [index ],nil ;};func Min (x ,y int )int {if x < y {return x ;};return y ;};func (_bd *Stack )Push (v interface{}){_bd .Data =append (_bd .Data ,v )};func (_af IntsMap )GetSlice (key uint64 )([]int ,bool ){_ec ,_c :=_af [key ];if !_c {return nil ,false ;
|
|
};return _ec ,true ;};func (_ea IntsMap )Add (key uint64 ,value int ){_ea [key ]=append (_ea [key ],value )};func (_g IntsMap )Get (key uint64 )(int ,bool ){_a ,_bf :=_g [key ];if !_bf {return 0,false ;};if len (_a )==0{return 0,false ;};return _a [0],true ;
|
|
};func (_ed *NumSlice )AddInt (v int ){*_ed =append (*_ed ,float32 (v ))};func (_d *IntSlice )Add (v int )error {if _d ==nil {return _e .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");
|
|
};*_d =append (*_d ,v );return nil ;};func NewNumSlice (i int )*NumSlice {_fe :=NumSlice (make ([]float32 ,i ));return &_fe };func (_feb *Stack )Pop ()(_afg interface{},_beb bool ){_afg ,_beb =_feb .peek ();if !_beb {return nil ,_beb ;};_feb .Data =_feb .Data [:_feb .top ()];
|
|
return _afg ,true ;};func Ceil (numerator ,denominator int )int {if numerator %denominator ==0{return numerator /denominator ;};return (numerator /denominator )+1;};type IntsMap map[uint64 ][]int ;func (_eee NumSlice )Get (i int )(float32 ,error ){if i < 0||i > len (_eee )-1{return 0,_e .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 _eee [i ],nil ;};func (_aff IntSlice )Size ()int {return len (_aff )};func (_fa *Stack )Peek ()(_ga interface{},_edg bool ){return _fa .peek ()};func Sign (v float32 )float32 {if v >=0.0{return 1.0;};return -1.0;};func (_bfc *Stack )peek ()(interface{},bool ){_cg :=_bfc .top ();
|
|
if _cg ==-1{return nil ,false ;};return _bfc .Data [_cg ],true ;};type IntSlice []int ;func Abs (v int )int {if v > 0{return v ;};return -v ;};func (_f IntsMap )Delete (key uint64 ){delete (_f ,key )};func (_bda *Stack )top ()int {return len (_bda .Data )-1};
|
|
func (_gg *NumSlice )Add (v float32 ){*_gg =append (*_gg ,v )};func NewIntSlice (i int )*IntSlice {_aa :=IntSlice (make ([]int ,i ));return &_aa };func Max (x ,y int )int {if x > y {return x ;};return y ;};type Stack struct{Data []interface{};Aux *Stack ;
|
|
}; |