simpledb
Class Type

java.lang.Object
  extended by simpledb.Type

public class Type
extends java.lang.Object

Class representing a type in SimpleDB. Types are static objects defined by this class; hence, the Type constructor is private.


Field Summary
(package private) static int INT_ID
           
static Type INT_TYPE
          Type object representing integers and strings (the only types currently supported by SimpleDB)
(package private)  int len
           
(package private) static int STRING_ID
           
static int STRING_LEN
           
static Type STRING_TYPE
           
(package private)  int typeId
           
 
Constructor Summary
private Type(int typeId)
           
 
Method Summary
 boolean equals(Type t)
           
 int getLen()
           
 Field parse(java.io.DataInputStream dis)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

typeId

int typeId

len

int len

INT_ID

static final int INT_ID
See Also:
Constant Field Values

STRING_ID

static final int STRING_ID
See Also:
Constant Field Values

STRING_LEN

public static final int STRING_LEN
See Also:
Constant Field Values

INT_TYPE

public static final Type INT_TYPE
Type object representing integers and strings (the only types currently supported by SimpleDB)


STRING_TYPE

public static final Type STRING_TYPE
Constructor Detail

Type

private Type(int typeId)
Method Detail

getLen

public int getLen()
Returns:
the number of bytes required to store a field of this type.

parse

public Field parse(java.io.DataInputStream dis)
            throws java.text.ParseException
Parameters:
dis - The input stream to read from
Returns:
a Field object of the same type as this object that has contents read from the specified DataInputStream.
Throws:
java.text.ParseException - if the data read from the input stream is not of the appropriate type.

equals

public boolean equals(Type t)
Returns:
true if the specified type is the same as the type of this object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object