|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.farrago.fennel.tuple.FennelTupleDatum
public class FennelTupleDatum
A FennelTupleDatum is a component of FennelTupleData; see the fennel tuple design document for more details.
This differs from the C++ version as we can't represent pointers in java. Therefore all the primitive accessors have been provided as methods of this object.
Internally, this object attempts to bypass object creation during normal use. It does this by wrangling all numeric primitive types into a 64-bit (long) value and all array data into a byte array. This class is JDK 1.4 compatible.
Field Summary | |
---|---|
private int |
capacity
maximum size of this data in externalized form. |
private int |
dataLen
length of this data in externalized form. |
private byte[] |
initialBytes
a byte array holding the initial byte array, of capacity size. |
private boolean |
isUnicode
if character data, whether the attribute descriptor is Unicode; otherwise false |
private long |
numeric
the numeric object kept by this tuple; this holds all the numeric primitive type. |
private boolean |
numericSet
indicates whether the numeric value has been set. |
private byte[] |
rawBytes
a byte array holding non-numeric information. |
private boolean |
rawBytesSet
indicates whether the byte array has been set. |
Constructor Summary | |
---|---|
FennelTupleDatum()
Constructs a raw datum; setCapacity must be called before use. |
|
FennelTupleDatum(FennelTupleDatum other)
copy constructor. |
|
FennelTupleDatum(int capacity)
Constructs a datum with a defined capacity. |
Method Summary | |
---|---|
void |
copyFrom(FennelTupleDatum other)
copy construction helper. |
boolean |
getBoolean()
gets a boolean value. |
byte |
getByte()
gets a signed byte value. |
byte[] |
getBytes()
gets a byte array. |
int |
getCapacity()
gets the capacity of this data item. |
double |
getDouble()
gets a double value. |
float |
getFloat()
gets a float value. |
int |
getInt()
gets a signed int value. |
int |
getLength()
gets the length, in bytes, of this datum. |
long |
getLong()
gets a signed long value. |
short |
getShort()
gets a signed short value. |
short |
getUnsignedByte()
gets an unsigned byte value |
long |
getUnsignedInt()
gets an unsigned int value. |
long |
getUnsignedLong()
gets an unsigned long value. |
int |
getUnsignedShort()
gets an unsigned short value. |
boolean |
isPresent()
Indicates whether data is present in this datum. |
boolean |
isUnicode()
Whether character data is stored as Unicode. |
void |
reset()
resets a datum for reuse. |
void |
setBoolean(boolean val)
sets a boolean value. |
void |
setByte(byte n)
sets the numeric value of a signed byte. |
void |
setBytes(byte[] bytes)
set the byte array. |
void |
setCapacity(int capacity)
sets the capacity of this data item. |
void |
setDouble(double val)
sets the numeric value of a double. |
void |
setFloat(float val)
sets the numeric value of a float. |
void |
setInt(int n)
sets the numeric value of a signed integer. |
void |
setLength(int len)
sets the length of this datum's byte array. |
void |
setLong(long n)
used by the attribute marshalling to set numeric values. |
byte[] |
setRawBytes()
used by the marshalling routines to set a byte array. |
void |
setShort(short n)
sets the numeric value of a signed short. |
void |
setString(String str)
set the byte array to a string. |
void |
setString(String str,
String charsetName)
|
(package private) void |
setUnicode(boolean isUnicode)
Sets the isUnicode flag; this is non-public because it is private to TupleData initialization. |
void |
setUnsignedByte(short val)
sets the numeric value of an unsigned byte. |
void |
setUnsignedInt(long val)
sets the numeric value of an unsigned integer. |
void |
setUnsignedLong(long val)
sets the numeric value of an unsigned long. |
void |
setUnsignedShort(int val)
sets the numeric value of an unsigned short. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int dataLen
private int capacity
private boolean isUnicode
private long numeric
private boolean numericSet
private byte[] rawBytes
private byte[] initialBytes
private boolean rawBytesSet
Constructor Detail |
---|
public FennelTupleDatum()
public FennelTupleDatum(int capacity)
public FennelTupleDatum(FennelTupleDatum other)
Method Detail |
---|
public void setCapacity(int capacity)
public int getCapacity()
public boolean isPresent()
public void reset()
public int getLength()
public void setLength(int len)
public void copyFrom(FennelTupleDatum other)
public void setLong(long n)
public void setInt(int n)
public void setUnsignedInt(long val)
public void setShort(short n)
public void setUnsignedShort(int val)
public void setByte(byte n)
public void setUnsignedByte(short val)
public void setUnsignedLong(long val)
public void setFloat(float val)
public void setDouble(double val)
public void setBoolean(boolean val)
public byte[] setRawBytes()
public long getLong() throws NullPointerException
NullPointerException
public int getInt() throws NullPointerException
NullPointerException
public short getShort() throws NullPointerException
NullPointerException
public byte getByte() throws NullPointerException
NullPointerException
public short getUnsignedByte() throws NullPointerException
NullPointerException
public int getUnsignedShort() throws NullPointerException
NullPointerException
public long getUnsignedInt() throws NullPointerException
NullPointerException
public long getUnsignedLong() throws NullPointerException
NullPointerException
public float getFloat() throws NullPointerException
NullPointerException
public double getDouble() throws NullPointerException
NullPointerException
public boolean getBoolean() throws NullPointerException
NullPointerException
public byte[] getBytes() throws NullPointerException
NullPointerException
public void setBytes(byte[] bytes)
public void setString(String str)
public void setString(String str, String charsetName) throws UnsupportedEncodingException
UnsupportedEncodingException
void setUnicode(boolean isUnicode)
public boolean isUnicode()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |