mirror of
https://github.com/unidoc/unipdf.git
synced 2025-04-27 13:48:51 +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 _a "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;};type IntsMap map[uint64 ][]int ;
|
|
func Abs (v int )int {if v > 0{return v ;};return -v ;};func (_bb NumSlice )Get (i int )(float32 ,error ){if i < 0||i > len (_bb )-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 _bb [i ],nil ;};func (_ba *IntSlice )Add (v int )error {if _ba ==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");
|
|
};*_ba =append (*_ba ,v );return nil ;};func (_bf IntsMap )GetSlice (key uint64 )([]int ,bool ){_bc ,_gc :=_bf [key ];if !_gc {return nil ,false ;};return _bc ,true ;};func (_cca *Stack )Pop ()(_baa interface{},_bae bool ){_baa ,_bae =_cca .peek ();if !_bae {return nil ,_bae ;
|
|
};_cca .Data =_cca .Data [:_cca .top ()];return _baa ,true ;};func (_bac *IntSlice )Copy ()*IntSlice {_cc :=IntSlice (make ([]int ,len (*_bac )));copy (_cc ,*_bac );return &_cc ;};func (_b IntsMap )Get (key uint64 )(int ,bool ){_ge ,_ac :=_b [key ];if !_ac {return 0,false ;
|
|
};if len (_ge )==0{return 0,false ;};return _ge [0],true ;};func (_f *Stack )Len ()int {return len (_f .Data )};func (_c IntsMap )Add (key uint64 ,value int ){_c [key ]=append (_c [key ],value )};func NewIntSlice (i int )*IntSlice {_bg :=IntSlice (make ([]int ,i ));
|
|
return &_bg };func (_cb *NumSlice )AddInt (v int ){*_cb =append (*_cb ,float32 (v ))};func Sign (v float32 )float32 {if v >=0.0{return 1.0;};return -1.0;};func (_ab *Stack )peek ()(interface{},bool ){_gbe :=_ab .top ();if _gbe ==-1{return nil ,false ;};
|
|
return _ab .Data [_gbe ],true ;};func (_aec NumSlice )GetIntSlice ()[]int {_acd :=make ([]int ,len (_aec ));for _dc ,_cbc :=range _aec {_acd [_dc ]=int (_cbc );};return _acd ;};func Max (x ,y int )int {if x > y {return x ;};return y ;};type Stack struct{Data []interface{};
|
|
Aux *Stack ;};func (_bba *Stack )Peek ()(_bce interface{},_gd bool ){return _bba .peek ()};func (_gb IntsMap )Delete (key uint64 ){delete (_gb ,key )};func (_dg NumSlice )GetInt (i int )(int ,error ){const _acb ="\u0047\u0065\u0074\u0049\u006e\u0074";if i < 0||i > len (_dg )-1{return 0,_a .Errorf (_acb ,"\u0069n\u0064\u0065\u0078\u003a\u0020\u0027\u0025\u0064\u0027\u0020\u006fu\u0074\u0020\u006f\u0066\u0020\u0072\u0061\u006e\u0067\u0065",i );
|
|
};_dd :=_dg [i ];return int (_dd +Sign (_dd )*0.5),nil ;};func (_cce *NumSlice )Add (v float32 ){*_cce =append (*_cce ,v )};type NumSlice []float32 ;func NewNumSlice (i int )*NumSlice {_ccg :=NumSlice (make ([]float32 ,i ));return &_ccg };func Min (x ,y int )int {if x < y {return x ;
|
|
};return y ;};func (_bca *Stack )top ()int {return len (_bca .Data )-1};type IntSlice []int ;func (_ae IntSlice )Size ()int {return len (_ae )};func (_d IntSlice )Get (index int )(int ,error ){if index > len (_d )-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 _d [index ],nil ;};func (_ad *Stack )Push (v interface{}){_ad .Data =append (_ad .Data ,v )}; |