1 31 package org.pdfbox.filter; 32 33 import java.util.HashMap ; 34 import java.util.Map ; 35 36 42 class LZWNode 43 { 44 private long code; 45 private Map subNodes = new HashMap (); 46 47 52 public int childCount() 53 { 54 return subNodes.size(); 55 } 56 57 63 public void setNode( byte b, LZWNode node ) 64 { 65 subNodes.put( new Byte ( b ), node ); 66 } 67 68 75 public LZWNode getNode( byte data ) 76 { 77 return (LZWNode)subNodes.get( new Byte ( data ) ); 78 } 79 80 81 89 public LZWNode getNode( byte[] data ) 90 { 91 LZWNode current = this; 92 for( int i=0; i<data.length && current != null; i++ ) 93 { 94 current = current.getNode( data[i] ); 95 } 96 return current; 97 } 98 99 102 public long getCode() 103 { 104 return code; 105 } 106 107 110 public void setCode(long codeValue) 111 { 112 code = codeValue; 113 } 114 115 } | Popular Tags |