1 2 17 18 package org.apache.poi.ddf; 19 20 import org.apache.poi.util.LittleEndian; 21 import org.apache.poi.util.HexDump; 22 23 30 public class EscherSimpleProperty extends EscherProperty 31 { 32 protected int propertyValue; 33 34 38 public EscherSimpleProperty( short id, int propertyValue ) 39 { 40 super( id ); 41 this.propertyValue = propertyValue; 42 } 43 44 48 public EscherSimpleProperty( short propertyNumber, boolean isComplex, boolean isBlipId, int propertyValue ) 49 { 50 super( propertyNumber, isComplex, isBlipId ); 51 this.propertyValue = propertyValue; 52 } 53 54 59 public int serializeSimplePart( byte[] data, int offset ) 60 { 61 LittleEndian.putShort(data, offset, getId()); 62 LittleEndian.putInt(data, offset + 2, propertyValue); 63 return 6; 64 } 65 66 70 public int serializeComplexPart( byte[] data, int pos ) 71 { 72 return 0; 73 } 74 75 78 public int getPropertyValue() 79 { 80 return propertyValue; 81 } 82 83 86 public boolean equals( Object o ) 87 { 88 if ( this == o ) return true; 89 if ( !( o instanceof EscherSimpleProperty ) ) return false; 90 91 final EscherSimpleProperty escherSimpleProperty = (EscherSimpleProperty) o; 92 93 if ( propertyValue != escherSimpleProperty.propertyValue ) return false; 94 if ( getId() != escherSimpleProperty.getId() ) return false; 95 96 return true; 97 } 98 99 103 public int hashCode() 104 { 105 return propertyValue; 106 } 107 108 111 public String toString() 112 { 113 return "propNum: " + getPropertyNumber() 114 + ", propName: " + EscherProperties.getPropertyName( getPropertyNumber() ) 115 + ", complex: " + isComplex() 116 + ", blipId: " + isBlipId() 117 + ", value: " + propertyValue + " (0x" + HexDump.toHex(propertyValue) + ")"; 118 } 119 120 } 121 | Popular Tags |