mirror of
https://github.com/unidoc/unipdf.git
synced 2025-04-27 13:48:51 +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 (_ca *NumSlice )AddInt (v int ){*_ca =append (*_ca ,float32 (v ))};func (_fa NumSlice )GetInt (i int )(int ,error ){const _gec ="\u0047\u0065\u0074\u0049\u006e\u0074";if i < 0||i > len (_fa )-1{return 0,_a .Errorf (_gec ,"\u0069n\u0064\u0065\u0078\u003a\u0020\u0027\u0025\u0064\u0027\u0020\u006fu\u0074\u0020\u006f\u0066\u0020\u0072\u0061\u006e\u0067\u0065",i );};_ag :=_fa [i ];return int (_ag +Sign (_ag )*0.5),nil ;};func Ceil (numerator ,denominator int )int {if numerator %denominator ==0{return numerator /denominator ;};return (numerator /denominator )+1;};func Max (x ,y int )int {if x > y {return x ;};return y ;};func (_e *IntSlice )Add (v int )error {if _e ==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");};*_e =append (*_e ,v );return nil ;};func (_cbg *Stack )Push (v interface{}){_cbg .Data =append (_cbg .Data ,v )};func (_gf *NumSlice )Add (v float32 ){*_gf =append (*_gf ,v )};func (_de *Stack )Len ()int {return len (_de .Data )};func (_afb *Stack )Peek ()(_aa interface{},_cge bool ){return _afb .peek ()};func (_gg IntsMap )Get (key uint64 )(int ,bool ){_b ,_c :=_gg [key ];if !_c {return 0,false ;};if len (_b )==0{return 0,false ;};return _b [0],true ;};type IntsMap map[uint64 ][]int ;type IntSlice []int ;func (_cd NumSlice )Get (i int )(float32 ,error ){if i < 0||i > len (_cd )-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 _cd [i ],nil ;};type NumSlice []float32 ;func (_d IntsMap )Add (key uint64 ,value int ){_d [key ]=append (_d [key ],value )};func NewIntSlice (i int )*IntSlice {_dd :=IntSlice (make ([]int ,i ));return &_dd };func (_cg IntsMap )GetSlice (key uint64 )([]int ,bool ){_ge ,_f :=_cg [key ];if !_f {return nil ,false ;};return _ge ,true ;};func Sign (v float32 )float32 {if v >=0.0{return 1.0;};return -1.0;};func (_ac *Stack )top ()int {return len (_ac .Data )-1};func NewNumSlice (i int )*NumSlice {_ed :=NumSlice (make ([]float32 ,i ));return &_ed };func Min (x ,y int )int {if x < y {return x ;};return y ;};func (_ef *Stack )peek ()(interface{},bool ){_gfa :=_ef .top ();if _gfa ==-1{return nil ,false ;};return _ef .Data [_gfa ],true ;};func (_af NumSlice )GetIntSlice ()[]int {_fgg :=make ([]int ,len (_af ));for _gd ,_gc :=range _af {_fgg [_gd ]=int (_gc );};return _fgg ;};func (_ab IntsMap )Delete (key uint64 ){delete (_ab ,key )};func (_fb *IntSlice )Copy ()*IntSlice {_fg :=IntSlice (make ([]int ,len (*_fb )));copy (_fg ,*_fb );return &_fg ;};func (_bc IntSlice )Size ()int {return len (_bc )};func Abs (v int )int {if v > 0{return v ;};return -v ;};type Stack struct{Data []interface{};Aux *Stack ;};func (_ee *Stack )Pop ()(_ad interface{},_gfd bool ){_ad ,_gfd =_ee .peek ();if !_gfd {return nil ,_gfd ;};_ee .Data =_ee .Data [:_ee .top ()];return _ad ,true ;};func (_cb IntSlice )Get (index int )(int ,error ){if index > len (_cb )-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 _cb [index ],nil ;}; |