mirror of
https://github.com/unidoc/unipdf.git
synced 2025-05-05 19:30:30 +08:00
23 lines
3.8 KiB
Go
23 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 _c "github.com/unidoc/unipdf/v3/internal/jbig2/errors";func (_ed *IntSlice )Copy ()*IntSlice {_aa :=IntSlice (make ([]int ,len (*_ed )));copy (_aa ,*_ed );return &_aa ;};type IntsMap map[uint64 ][]int ;func (_b *IntSlice )Add (v int )error {if _b ==nil {return _c .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");
|
|
};*_b =append (*_b ,v );return nil ;};func (_db NumSlice )GetIntSlice ()[]int {_fa :=make ([]int ,len (_db ));for _bg ,_cd :=range _db {_fa [_bg ]=int (_cd );};return _fa ;};func Max (x ,y int )int {if x > y {return x ;};return y ;};type Stack struct{Data []interface{};
|
|
Aux *Stack ;};func (_fe *Stack )Pop ()(_bfa interface{},_eb bool ){_bfa ,_eb =_fe .peek ();if !_eb {return nil ,_eb ;};_fe .Data =_fe .Data [:_fe .top ()];return _bfa ,true ;};func NewIntSlice (i int )*IntSlice {_gd :=IntSlice (make ([]int ,i ));return &_gd };
|
|
type IntSlice []int ;func (_f IntsMap )Get (key uint64 )(int ,bool ){_g ,_ce :=_f [key ];if !_ce {return 0,false ;};if len (_g )==0{return 0,false ;};return _g [0],true ;};func (_a IntsMap )Add (key uint64 ,value int ){_a [key ]=append (_a [key ],value )};
|
|
func NewNumSlice (i int )*NumSlice {_dc :=NumSlice (make ([]float32 ,i ));return &_dc };func (_da IntSlice )Size ()int {return len (_da )};func Ceil (numerator ,denominator int )int {if numerator %denominator ==0{return numerator /denominator ;};return (numerator /denominator )+1;
|
|
};func (_ag *NumSlice )Add (v float32 ){*_ag =append (*_ag ,v )};func (_ca NumSlice )GetInt (i int )(int ,error ){const _cg ="\u0047\u0065\u0074\u0049\u006e\u0074";if i < 0||i > len (_ca )-1{return 0,_c .Errorf (_cg ,"\u0069n\u0064\u0065\u0078\u003a\u0020\u0027\u0025\u0064\u0027\u0020\u006fu\u0074\u0020\u006f\u0066\u0020\u0072\u0061\u006e\u0067\u0065",i );
|
|
};_be :=_ca [i ];return int (_be +Sign (_be )*0.5),nil ;};func (_abc NumSlice )Get (i int )(float32 ,error ){if i < 0||i > len (_abc )-1{return 0,_c .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 _abc [i ],nil ;};func Sign (v float32 )float32 {if v >=0.0{return 1.0;};return -1.0;};type NumSlice []float32 ;func (_fc *Stack )Push (v interface{}){_fc .Data =append (_fc .Data ,v )};func Abs (v int )int {if v > 0{return v ;};return -v ;};func Min (x ,y int )int {if x < y {return x ;
|
|
};return y ;};func (_d IntSlice )Get (index int )(int ,error ){if index > len (_d )-1{return 0,_c .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 _d [index ],nil ;};func (_cag *Stack )peek ()(interface{},bool ){_ee :=_cag .top ();if _ee ==-1{return nil ,false ;};return _cag .Data [_ee ],true ;};func (_gf *Stack )Len ()int {return len (_gf .Data )};func (_af IntsMap )Delete (key uint64 ){delete (_af ,key )};
|
|
func (_fb *NumSlice )AddInt (v int ){*_fb =append (*_fb ,float32 (v ))};func (_ab IntsMap )GetSlice (key uint64 )([]int ,bool ){_ad ,_fd :=_ab [key ];if !_fd {return nil ,false ;};return _ad ,true ;};func (_aaa *Stack )top ()int {return len (_aaa .Data )-1};
|
|
func (_bf *Stack )Peek ()(_dad interface{},_bc bool ){return _bf .peek ()}; |