12 lines
11 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-08-31 21:12:07 +00:00
package huffman ;import (_ed "errors";_f "fmt";_d "github.com/unidoc/unipdf/v3/internal/bitwise";_ea "math";_e "strings";);func (_af *StandardTable )Decode (r _d .StreamReader )(int64 ,error ){return _af ._caf .Decode (r )};func NewEncodedTable (table BasicTabler )(*EncodedTable ,error ){_fb :=&EncodedTable {_c :&InternalNode {},BasicTabler :table };if _eaf :=_fb .parseTable ();_eaf !=nil {return nil ,_eaf ;};return _fb ,nil ;};var _ Node =&OutOfBandNode {};type EncodedTable struct{BasicTabler ;_c *InternalNode ;};func (_cfd *FixedSizeTable )InitTree (codeTable []*Code )error {_bfc (codeTable );for _ ,_gfc :=range codeTable {_db :=_cfd ._eag .append (_gfc );if _db !=nil {return _db ;};};return nil ;};func (_dccb *StandardTable )RootNode ()*InternalNode {return _dccb ._caf };type OutOfBandNode struct{};func (_gbb *InternalNode )append (_efd *Code )(_aca error ){if _efd ._fdba ==0{return nil ;};_dcc :=_efd ._fdba -1-_gbb ._gc ;if _dcc < 0{return _ed .New ("\u004e\u0065\u0067\u0061\u0074\u0069\u0076\u0065\u0020\u0073\u0068\u0069\u0066\u0074\u0069n\u0067 \u0069\u0073\u0020\u006e\u006f\u0074\u0020\u0061\u006c\u006c\u006f\u0077\u0065\u0064");};_aa :=(_efd ._edg >>uint (_dcc ))&0x1;if _dcc ==0{if _efd ._cbac ==-1{if _aa ==1{if _gbb ._gbf !=nil {return _f .Errorf ("O\u004f\u0042\u0020\u0061\u006c\u0072e\u0061\u0064\u0079\u0020\u0073\u0065\u0074\u0020\u0066o\u0072\u0020\u0063o\u0064e\u0020\u0025\u0073",_efd );};_gbb ._gbf =_bd (_efd );}else {if _gbb ._bg !=nil {return _f .Errorf ("O\u004f\u0042\u0020\u0061\u006c\u0072e\u0061\u0064\u0079\u0020\u0073\u0065\u0074\u0020\u0066o\u0072\u0020\u0063o\u0064e\u0020\u0025\u0073",_efd );};_gbb ._bg =_bd (_efd );};}else {if _aa ==1{if _gbb ._gbf !=nil {return _f .Errorf ("\u0056\u0061\u006cue\u0020\u004e\u006f\u0064\u0065\u0020\u0061\u006c\u0072e\u0061d\u0079 \u0073e\u0074\u0020\u0066\u006f\u0072\u0020\u0063\u006f\u0064\u0065\u0020\u0025\u0073",_efd );};_gbb ._gbf =_fgc (_efd );}else {if _gbb ._bg !=nil {return _f .Errorf ("\u0056\u0061\u006cue\u0020\u004e\u006f\u0064\u0065\u0020\u0061\u006c\u0072e\u0061d\u0079 \u0073e\u0074\u0020\u0066\u006f\u0072\u0020\u0063\u006f\u0064\u0065\u0020\u0025\u0073",_efd );};_gbb ._bg =_fgc (_efd );};};}else {if _aa ==1{if _gbb ._gbf ==nil {_gbb ._gbf =_dbfd (_gbb ._gc +1);};if _aca =_gbb ._gbf .(*InternalNode ).append (_efd );_aca !=nil {return _aca ;};}else {if _gbb ._bg ==nil {_gbb ._bg =_dbfd (_gbb ._gc +1);};if _aca =_gbb ._bg .(*InternalNode ).append (_efd );_aca !=nil {return _aca ;};};};return nil ;};func NewFixedSizeTable (codeTable []*Code )(*FixedSizeTable ,error ){_dc :=&FixedSizeTable {_eag :&InternalNode {}};if _ac :=_dc .InitTree (codeTable );_ac !=nil {return nil ,_ac ;};return _dc ,nil ;};func (_be *EncodedTable )InitTree (codeTable []*Code )error {_bfc (codeTable );for _ ,_fd :=range codeTable {if _cb :=_be ._c .append (_fd );_cb !=nil {return _cb ;};};return nil ;};func NewCode (prefixLength ,rangeLength ,rangeLow int32 ,isLowerRange bool )*Code {return &Code {_fdba :prefixLength ,_cbac :rangeLength ,_bf :rangeLow ,_acg :isLowerRange ,_edg :-1};};func (_eg *ValueNode )Decode (r _d .StreamReader )(int64 ,error ){_fag ,_fbe :=r .ReadBits (byte (_eg ._bb ));if _fbe !=nil {return 0,_fbe ;};if _eg ._eb {_fag =-_fag ;};return int64 (_eg ._cg )+int64 (_fag ),nil ;};func (_dd *OutOfBandNode )String ()string {return _f .Sprintf ("\u0025\u0030\u00364\u0062",int64 (_ea .MaxInt64 ));};var _ Node =&ValueNode {};func (_da *StandardTable )InitTree (codeTable []*Code )error {_bfc (codeTable );for _ ,_dfc :=range codeTable {if _cab :=_da ._caf .append (_dfc );_cab !=nil {return _cab ;};};return nil ;};func (_cc *OutOfBandNode )Decode (r _d .StreamReader )(int64 ,error ){return int64 (_ea .MaxInt64 ),nil };type StandardTable struct{_caf *InternalNode };func _bd (_fba *Code )*OutOfBandNode {return &OutOfBandNode {}};func _gce (_bcg [][]int32 )(*StandardTable ,error ){var _cgb []*Code ;for _bge :=0;_bge < len (_bcg );_bge ++{_efa :=_bcg [_bge ][0];_ebg :=_bcg [_bge ][1];_dea :=_bcg [_bge ][2];var _agb bool ;if len (_bcg [_bge ])> 3{_agb =true ;};_cgb =append (_cg