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/
2023-06-30 13:19:48 +00:00
package basic ;import _dg "github.com/unidoc/unipdf/v3/internal/jbig2/errors";func Ceil (numerator ,denominator int )int {if numerator %denominator ==0{return numerator /denominator ;};return (numerator /denominator )+1;};func (_dgc *IntSlice )Copy ()*IntSlice {_gc :=IntSlice (make ([]int ,len (*_dgc )));
copy (_gc ,*_dgc );return &_gc ;};type IntsMap map[uint64 ][]int ;func (_ce IntSlice )Get (index int )(int ,error ){if index > len (_ce )-1{return 0,_dg .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 _ce [index ],nil ;};func (_f IntsMap )Add (key uint64 ,value int ){_f [key ]=append (_f [key ],value )};func NewIntSlice (i int )*IntSlice {_a :=IntSlice (make ([]int ,i ));return &_a };func (_ga IntSlice )Size ()int {return len (_ga )};func (_bd *Stack )peek ()(interface{},bool ){_ba :=_bd .top ();
if _ba ==-1{return nil ,false ;};return _bd .Data [_ba ],true ;};func (_cg NumSlice )GetIntSlice ()[]int {_ae :=make ([]int ,len (_cg ));for _ge ,_gab :=range _cg {_ae [_ge ]=int (_gab );};return _ae ;};func (_fcd NumSlice )Get (i int )(float32 ,error ){if i < 0||i > len (_fcd )-1{return 0,_dg .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 _fcd [i ],nil ;};func (_fbd *Stack )top ()int {return len (_fbd .Data )-1};func Min (x ,y int )int {if x < y {return x ;};return y ;};func NewNumSlice (i int )*NumSlice {_ab :=NumSlice (make ([]float32 ,i ));return &_ab };func Sign (v float32 )float32 {if v >=0.0{return 1.0;
};return -1.0;};func Max (x ,y int )int {if x > y {return x ;};return y ;};func (_g IntsMap )GetSlice (key uint64 )([]int ,bool ){_gb ,_fb :=_g [key ];if !_fb {return nil ,false ;};return _gb ,true ;};func (_eb *Stack )Peek ()(_fg interface{},_gg bool ){return _eb .peek ()};
func (_gcg *Stack )Len ()int {return len (_gcg .Data )};type IntSlice []int ;func (_fc *NumSlice )AddInt (v int ){*_fc =append (*_fc ,float32 (v ))};func (_cc NumSlice )GetInt (i int )(int ,error ){const _cf ="\u0047\u0065\u0074\u0049\u006e\u0074";if i < 0||i > len (_cc )-1{return 0,_dg .Errorf (_cf ,"\u0069n\u0064\u0065\u0078\u003a\u0020\u0027\u0025\u0064\u0027\u0020\u006fu\u0074\u0020\u006f\u0066\u0020\u0072\u0061\u006e\u0067\u0065",i );
};_db :=_cc [i ];return int (_db +Sign (_db )*0.5),nil ;};func (_b IntsMap )Get (key uint64 )(int ,bool ){_e ,_c :=_b [key ];if !_c {return 0,false ;};if len (_e )==0{return 0,false ;};return _e [0],true ;};func (_da *IntSlice )Add (v int )error {if _da ==nil {return _dg .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");
};*_da =append (*_da ,v );return nil ;};func (_ea *NumSlice )Add (v float32 ){*_ea =append (*_ea ,v )};type Stack struct{Data []interface{};Aux *Stack ;};func (_dc *Stack )Pop ()(_ff interface{},_df bool ){_ff ,_df =_dc .peek ();if !_df {return nil ,_df ;
};_dc .Data =_dc .Data [:_dc .top ()];return _ff ,true ;};func (_be IntsMap )Delete (key uint64 ){delete (_be ,key )};func Abs (v int )int {if v > 0{return v ;};return -v ;};func (_gad *Stack )Push (v interface{}){_gad .Data =append (_gad .Data ,v )};type NumSlice []float32 ;