mirror of
https://github.com/unidoc/unipdf.git
synced 2025-05-04 22:17:22 +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 _cc "github.com/unidoc/unipdf/v3/internal/jbig2/errors";func (_ec NumSlice )GetIntSlice ()[]int {_bf :=make ([]int ,len (_ec ));for _dd ,_fdc :=range _ec {_bf [_dd ]=int (_fdc );};return _bf ;};func (_ea IntsMap )Delete (key uint64 ){delete (_ea ,key )};
|
|
func (_ag IntSlice )Get (index int )(int ,error ){if index > len (_ag )-1{return 0,_cc .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 _ag [index ],nil ;};func Max (x ,y int )int {if x > y {return x ;};return y ;};func Abs (v int )int {if v > 0{return v ;};return -v ;};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 (_gdf *Stack )Pop ()(_cd interface{},_ga bool ){_cd ,_ga =_gdf .peek ();if !_ga {return nil ,_ga ;};_gdf .Data =_gdf .Data [:_gdf .top ()];return _cd ,true ;};func (_ac IntSlice )Size ()int {return len (_ac )};
|
|
type Stack struct{Data []interface{};Aux *Stack ;};func (_b *NumSlice )Add (v float32 ){*_b =append (*_b ,v )};func (_d IntsMap )Add (key uint64 ,value int ){_d [key ]=append (_d [key ],value )};func (_db *NumSlice )AddInt (v int ){*_db =append (*_db ,float32 (v ))};
|
|
func (_gaf *Stack )top ()int {return len (_gaf .Data )-1};func (_ge *Stack )Push (v interface{}){_ge .Data =append (_ge .Data ,v )};func NewNumSlice (i int )*NumSlice {_df :=NumSlice (make ([]float32 ,i ));return &_df };func (_aga *Stack )Len ()int {return len (_aga .Data )};
|
|
func (_fd *IntSlice )Add (v int )error {if _fd ==nil {return _cc .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");};*_fd =append (*_fd ,v );
|
|
return nil ;};func (_e IntsMap )GetSlice (key uint64 )([]int ,bool ){_cg ,_f :=_e [key ];if !_f {return nil ,false ;};return _cg ,true ;};func Sign (v float32 )float32 {if v >=0.0{return 1.0;};return -1.0;};type IntsMap map[uint64 ][]int ;func (_da IntsMap )Get (key uint64 )(int ,bool ){_g ,_a :=_da [key ];
|
|
if !_a {return 0,false ;};if len (_g )==0{return 0,false ;};return _g [0],true ;};type NumSlice []float32 ;func (_fdd NumSlice )GetInt (i int )(int ,error ){const _cbe ="\u0047\u0065\u0074\u0049\u006e\u0074";if i < 0||i > len (_fdd )-1{return 0,_cc .Errorf (_cbe ,"\u0069n\u0064\u0065\u0078\u003a\u0020\u0027\u0025\u0064\u0027\u0020\u006fu\u0074\u0020\u006f\u0066\u0020\u0072\u0061\u006e\u0067\u0065",i );
|
|
};_ef :=_fdd [i ];return int (_ef +Sign (_ef )*0.5),nil ;};func (_eg *IntSlice )Copy ()*IntSlice {_egd :=IntSlice (make ([]int ,len (*_eg )));copy (_egd ,*_eg );return &_egd ;};func (_gd *Stack )Peek ()(_gdg interface{},_ce bool ){return _gd .peek ()};
|
|
func (_cgd NumSlice )Get (i int )(float32 ,error ){if i < 0||i > len (_cgd )-1{return 0,_cc .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 _cgd [i ],nil ;};func (_ad *Stack )peek ()(interface{},bool ){_gg :=_ad .top ();if _gg ==-1{return nil ,false ;};return _ad .Data [_gg ],true ;};type IntSlice []int ;func NewIntSlice (i int )*IntSlice {_cb :=IntSlice (make ([]int ,i ));return &_cb };
|