1 package com.daffodilwoods.daffodildb.utils.field; 2 3 import com.daffodilwoods.daffodildb.utils.BufferRange; 4 import com.daffodilwoods.database.resource.DException; 5 import com.daffodilwoods.daffodildb.utils.GetByteComparator; 6 7 public class FieldBoolean extends FieldBase implements Comparable { 8 9 public FieldBoolean(BufferRange bufferRange0,int datatype0) { 10 bufferRange = bufferRange0; 11 datatype = datatype0; 12 } 13 14 public Object getObject() throws DException{ 15 if(bufferRange.getNull()) 16 return null; 17 if(object!=null) 18 return object; 19 boolean a = (bufferRange.getByte(0) == 1) ? true : false; 20 21 return object=new Boolean (a); 22 23 } 24 25 public boolean equals(Object fieldBase){ 26 try { 27 return (getDatatype() != ((FieldBase)fieldBase).getDatatype()) ? false : 28 GetByteComparator.oneByteComparator.compare(this,fieldBase) == 0 ; 29 } 30 catch (DException ex) { 31 return false; 32 } 33 } 34 35 public int compareTo(Object fieldBase){ 36 try { 37 return GetByteComparator.oneByteComparator.compare(this,fieldBase) ; 38 } 39 catch (DException ex) { 40 return -1; 41 } 42 } 43 44 45 } 46 | Popular Tags |