simpledb
Class IntField

java.lang.Object
  extended by simpledb.IntField
All Implemented Interfaces:
Field

public class IntField
extends java.lang.Object
implements Field

Instance of Field that stores a single integer.


Field Summary
private  int value
           
 
Constructor Summary
IntField(int i)
          Constructor.
 
Method Summary
 boolean compare(Predicate.Op op, Field val)
          Compare the specified field to the value of this Field.
 boolean equals(java.lang.Object field)
           
 Type getType()
          Return the Type of this field.
 int getValue()
           
 int hashCode()
          Hash code.
 void serialize(java.io.DataOutputStream dos)
          Write the bytes representing this field to the specified DataOutputStream.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

value

private int value
Constructor Detail

IntField

public IntField(int i)
Constructor.

Parameters:
i - The value of this field.
Method Detail

getValue

public int getValue()

toString

public java.lang.String toString()
Specified by:
toString in interface Field
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Description copied from interface: Field
Hash code. Different Field objects representing the same value should probably return the same hashCode.

Specified by:
hashCode in interface Field
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object field)
Specified by:
equals in interface Field
Overrides:
equals in class java.lang.Object

serialize

public void serialize(java.io.DataOutputStream dos)
               throws java.io.IOException
Description copied from interface: Field
Write the bytes representing this field to the specified DataOutputStream.

Specified by:
serialize in interface Field
Parameters:
dos - The DataOutputStream to write to.
Throws:
java.io.IOException
See Also:
DataOutputStream

compare

public boolean compare(Predicate.Op op,
                       Field val)
Compare the specified field to the value of this Field. Return semantics are as specified by Field.compare

Specified by:
compare in interface Field
Parameters:
op - The operator
val - The value to compare this Field to
Returns:
Whether or not the comparison yields true.
Throws:
IllegalCastException - if val is not an IntField
See Also:
Field.compare(simpledb.Predicate.Op, simpledb.Field)

getType

public Type getType()
Return the Type of this field.

Specified by:
getType in interface Field
Returns:
Type.INT_TYPE