22 lines
3.8 KiB
Go
Raw Normal View History

2020-08-27 21:45:09 +00:00
//
// 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/
2024-05-29 17:04:37 +00:00
package basic ;import _d "github.com/unidoc/unipdf/v3/internal/jbig2/errors";func (_ga *Stack )top ()int {return len (_ga .Data )-1};func Max (x ,y int )int {if x > y {return x ;};return y ;};func (_cg NumSlice )GetInt (i int )(int ,error ){const _bd ="\u0047\u0065\u0074\u0049\u006e\u0074";
if i < 0||i > len (_cg )-1{return 0,_d .Errorf (_bd ,"\u0069n\u0064\u0065\u0078\u003a\u0020\u0027\u0025\u0064\u0027\u0020\u006fu\u0074\u0020\u006f\u0066\u0020\u0072\u0061\u006e\u0067\u0065",i );};_bae :=_cg [i ];return int (_bae +Sign (_bae )*0.5),nil ;
};type Stack struct{Data []interface{};Aux *Stack ;};func (_cae IntSlice )Size ()int {return len (_cae )};func (_fc IntsMap )GetSlice (key uint64 )([]int ,bool ){_ba ,_fcb :=_fc [key ];if !_fcb {return nil ,false ;};return _ba ,true ;};func (_ac *NumSlice )Add (v float32 ){*_ac =append (*_ac ,v )};
type IntSlice []int ;func (_df IntsMap )Add (key uint64 ,value int ){_df [key ]=append (_df [key ],value )};func (_c IntsMap )Get (key uint64 )(int ,bool ){_b ,_cb :=_c [key ];if !_cb {return 0,false ;};if len (_b )==0{return 0,false ;};return _b [0],true ;
};func (_dfd IntsMap )Delete (key uint64 ){delete (_dfd ,key )};func NewNumSlice (i int )*NumSlice {_dc :=NumSlice (make ([]float32 ,i ));return &_dc };func NewIntSlice (i int )*IntSlice {_ca :=IntSlice (make ([]int ,i ));return &_ca };func (_ff *IntSlice )Add (v int )error {if _ff ==nil {return _d .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");
};*_ff =append (*_ff ,v );return nil ;};type NumSlice []float32 ;func (_a *IntSlice )Copy ()*IntSlice {_ag :=IntSlice (make ([]int ,len (*_a )));copy (_ag ,*_a );return &_ag ;};func (_e IntSlice )Get (index int )(int ,error ){if index > len (_e )-1{return 0,_d .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 _e [index ],nil ;};func (_ce *Stack )Push (v interface{}){_ce .Data =append (_ce .Data ,v )};func (_fd *NumSlice )AddInt (v int ){*_fd =append (*_fd ,float32 (v ))};func (_fcd NumSlice )GetIntSlice ()[]int {_be :=make ([]int ,len (_fcd ));for _ed ,_g :=range _fcd {_be [_ed ]=int (_g );
};return _be ;};func Ceil (numerator ,denominator int )int {if numerator %denominator ==0{return numerator /denominator ;};return (numerator /denominator )+1;};func Min (x ,y int )int {if x < y {return x ;};return y ;};func (_cc *Stack )Peek ()(_gb interface{},_ab bool ){return _cc .peek ()};
func (_dfg *Stack )Pop ()(_dfc interface{},_eg bool ){_dfc ,_eg =_dfg .peek ();if !_eg {return nil ,_eg ;};_dfg .Data =_dfg .Data [:_dfg .top ()];return _dfc ,true ;};type IntsMap map[uint64 ][]int ;func Abs (v int )int {if v > 0{return v ;};return -v ;
};func (_ad *Stack )peek ()(interface{},bool ){_da :=_ad .top ();if _da ==-1{return nil ,false ;};return _ad .Data [_da ],true ;};func (_db *Stack )Len ()int {return len (_db .Data )};func (_de NumSlice )Get (i int )(float32 ,error ){if i < 0||i > len (_de )-1{return 0,_d .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 _de [i ],nil ;};func Sign (v float32 )float32 {if v >=0.0{return 1.0;};return -1.0;};