12 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/
2020-09-21 01:20:10 +00:00
package basic ;import _f "github.com/unidoc/unipdf/v3/internal/jbig2/errors";func Sign (v float32 )float32 {if v >=0.0{return 1.0;};return -1.0;};type NumSlice []float32 ;func Ceil (numerator ,denominator int )int {if numerator %denominator ==0{return numerator /denominator ;};return (numerator /denominator )+1;};func (_a IntsMap )Add (key uint64 ,value int ){_a [key ]=append (_a [key ],value )};func (_ag IntSlice )Size ()int {return len (_ag )};func (_cf *IntSlice )Add (v int )error {if _cf ==nil {return _f .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");};*_cf =append (*_cf ,v );return nil ;};func (_ba *Stack )peek ()(interface{},bool ){_gab :=_ba .top ();if _gab ==-1{return nil ,false ;};return _ba .Data [_gab ],true ;};func (_gf *NumSlice )Add (v float32 ){*_gf =append (*_gf ,v )};func (_eb NumSlice )GetInt (i int )(int ,error ){const _gg ="\u0047\u0065\u0074\u0049\u006e\u0074";if i < 0||i > len (_eb )-1{return 0,_f .Errorf (_gg ,"\u0069n\u0064\u0065\u0078\u003a\u0020\u0027\u0025\u0064\u0027\u0020\u006fu\u0074\u0020\u006f\u0066\u0020\u0072\u0061\u006e\u0067\u0065",i );};_db :=_eb [i ];return int (_db +Sign (_db )*0.5),nil ;};func Min (x ,y int )int {if x < y {return x ;};return y ;};type Stack struct{Data []interface{};Aux *Stack ;};type IntsMap map[uint64 ][]int ;func (_dd IntSlice )Get (index int )(int ,error ){if index > len (_dd )-1{return 0,_f .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 _dd [index ],nil ;};func NewIntSlice (i int )*IntSlice {_c :=IntSlice (make ([]int ,i ));return &_c };func (_fd *Stack )top ()int {return len (_fd .Data )-1};func (_bb NumSlice )Get (i int )(float32 ,error ){if i < 0||i > len (_bb )-1{return 0,_f .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 (_be *Stack )Pop ()(_gcf interface{},_bbb bool ){_gcf ,_bbb =_be .peek ();if !_bbb {return nil ,_bbb ;};_be .Data =_be .Data [:_be .top ()];return _gcf ,true ;};func (_gc *Stack )Len ()int {return len (_gc .Data )};func (_afg *Stack )Push (v interface{}){_afg .Data =append (_afg .Data ,v )};func (_af *IntSlice )Copy ()*IntSlice {_dc :=IntSlice (make ([]int ,len (*_af )));copy (_dc ,*_af );return &_dc ;};func (_ecc *Stack )Peek ()(_ed interface{},_gb bool ){return _ecc .peek ()};func NewNumSlice (i int )*NumSlice {_ga :=NumSlice (make ([]float32 ,i ));return &_ga };type IntSlice []int ;func (_ff IntsMap )Delete (key uint64 ){delete (_ff ,key )};func (_ec NumSlice )GetIntSlice ()[]int {_cd :=make ([]int ,len (_ec ));for _de ,_bbg :=range _ec {_cd [_de ]=int (_bbg );};return _cd ;};func Abs (v int )int {if v > 0{return v ;};return -v ;};func (_ad IntsMap )GetSlice (key uint64 )([]int ,bool ){_d ,_aa :=_ad [key ];if !_aa {return nil ,false ;};return _d ,true ;};func (_fg IntsMap )Get (key uint64 )(int ,bool ){_e ,_b :=_fg [key ];if !_b {return 0,false ;};if len (_e )==0{return 0,false ;};return _e [0],true ;};func Max (x ,y int )int {if x > y {return x ;};return y ;};func (_ee *NumSlice )AddInt (v int ){*_ee =append (*_ee ,float32 (v ))};