1 package com.daffodilwoods.daffodildb.utils.field; 2 3 import java.util.*; 4 import com.daffodilwoods.daffodildb.server.sql99.common.Datatypes; 5 import com.daffodilwoods.database.resource.DException; 6 import com.daffodilwoods.daffodildb.utils.BufferRange; 7 import com.daffodilwoods.daffodildb.server.datasystem.persistentsystem.TableKey; 8 import com.daffodilwoods.database.utility.P; 9 10 public class FieldTableKey extends FieldBase implements Datatypes,Comparable { 11 12 public FieldTableKey(BufferRange bufferRange0,int datatype0) { 13 super(bufferRange0,datatype0); 14 } 15 16 public Object getObject() throws DException{ 17 if(bufferRange.getNull()) 18 return null; 19 int add = getIntValue(bufferRange,0); 20 short rec = getShortValue(bufferRange,4); 21 if(rec == 0) 22 ; return new TableKey(add,rec); 24 } 25 26 private long getLongValue(BufferRange buff,int position)throws DException{ 27 long a=0; 28 for(int i=position,k=position+8,j=56;i < k; i++,j-=8) 29 a += ((long)buff.getByte(i) & 0xFF) << j; 30 return a; 31 } 32 33 private int getIntValue(BufferRange buff,int position){ 34 35 int a=0; 36 for(int i=position,k=position+4,j=24;i < k; i++,j-=8) 37 a += ((short)buff.getByte(i) & 0xFF) << j; 38 return a; 39 40 } 41 42 public final static short getShortValue(BufferRange bytes,int position)throws DException{ 43 short a=0; 44 for(int i=position,k=position+2,j=8;i < k; i++,j-=8) 45 a += ((short)bytes.getByte(i) & 0xFF) << j; 46 return a; 47 } 48 49 public boolean equals(Object fieldBase){ 50 throw new java.lang.UnsupportedOperationException ("Method not yet implemented."); 51 } 52 53 public int compareTo(Object fieldBase){ 54 throw new java.lang.UnsupportedOperationException ("Method not yet implemented."); 55 } 56 57 58 } 59 | Popular Tags |