sg.edu.nus.peer.info
Class ContentInfo

java.lang.Object
  extended by sg.edu.nus.peer.info.ContentInfo
All Implemented Interfaces:
java.io.Serializable

public class ContentInfo
extends java.lang.Object
implements java.io.Serializable

Implement the index key set of each node in the BATON tree.

Version:
1.0 2006-2-7
Author:
Quang Hieu Vu, (Modified by) Xu Linhao, (Modified by) Quang Hieu Vu, (Modified by) David Jiang
See Also:
Serialized Form

Field Summary
static int INSERT_AS_MAX_KEY
          If the index key to be inserted is bigger than the old max index key.
static int INSERT_AS_MIN_KEY
          If the index key to be inserted is smaller than the old min index key.
static int INSERT_NORMALLY
          If the index key to be inserted lies in the range of the min and max index key.
 
Constructor Summary
ContentInfo(BoundaryValue minValue, BoundaryValue maxValue, int order, java.util.Vector<IndexValue> data)
          Contruct the set of the index keys at each super node.
ContentInfo(java.lang.String serializeData)
          Construct the set of the index keys with a serialized string value.
 
Method Summary
 int compareTo(java.lang.String value)
          Compare the value with the range >0 for greater =0 for equal <0 for less than
 void deleteAll()
          Remove all index keys.
 void deleteData(IndexValue dataValue)
          Delete an index key from the key set.
 java.util.Vector<IndexValue> getData()
          Get the set of the index value.
 BoundaryValue getMaxValue()
          Get the maximum index value.
 BoundaryValue getMinValue()
          Get the minimum index value.
 int getOrder()
          Get the ratio of the load balance.
 void insertData(IndexValue dataValue, int mode)
          Insert an index key into the local key set.
 boolean isGreaterThanRange(java.lang.String value)
          Check if the value is greater than the range
 boolean isInRange(java.lang.String value)
          Check if the value is in the range
 boolean isLessThanRange(java.lang.String value)
          Check if the value is less than the range A value is less than the range if it is less than the lower bound of that range
 boolean isOverloaded()
          FIXME: Determine if the node is overload.
 java.lang.String serialize()
          Get the serialized representation of the ContentInfo.
 void setData(java.util.Vector<IndexValue> data)
           
 void setMaxValue(BoundaryValue maxValue)
          Set the maximum index value.
 void setMinValue(BoundaryValue minValue)
          Set the minimum index value.
 void setOrder(int order)
          Set the ratio of the load balance.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INSERT_NORMALLY

public static final int INSERT_NORMALLY
If the index key to be inserted lies in the range of the min and max index key.

See Also:
Constant Field Values

INSERT_AS_MIN_KEY

public static final int INSERT_AS_MIN_KEY
If the index key to be inserted is smaller than the old min index key.

See Also:
Constant Field Values

INSERT_AS_MAX_KEY

public static final int INSERT_AS_MAX_KEY
If the index key to be inserted is bigger than the old max index key.

See Also:
Constant Field Values
Constructor Detail

ContentInfo

public ContentInfo(BoundaryValue minValue,
                   BoundaryValue maxValue,
                   int order,
                   java.util.Vector<IndexValue> data)
Contruct the set of the index keys at each super node.

Parameters:
minValue - the minimum index value
maxValue - the maximum index value
order - the load balance ratio
data - the set of the index keys

ContentInfo

public ContentInfo(java.lang.String serializeData)
Construct the set of the index keys with a serialized string value.

Parameters:
serializeData - the serialized string value
Method Detail

setMinValue

public void setMinValue(BoundaryValue minValue)
Set the minimum index value.

Parameters:
minValue - the minimum index value

getMinValue

public BoundaryValue getMinValue()
Get the minimum index value.

Returns:
the minimum index value

setMaxValue

public void setMaxValue(BoundaryValue maxValue)
Set the maximum index value.

Parameters:
maxValue - the maximum index value

getMaxValue

public BoundaryValue getMaxValue()
Get the maximum index value.

Returns:
the maximum index value

setOrder

public void setOrder(int order)
Set the ratio of the load balance.

Parameters:
order - the ratio of the load balance

getOrder

public int getOrder()
Get the ratio of the load balance.

Returns:
the ratio of the load balance

getData

public java.util.Vector<IndexValue> getData()
Get the set of the index value.

Returns:
the set of the index key

setData

public void setData(java.util.Vector<IndexValue> data)

deleteAll

public void deleteAll()
Remove all index keys.


insertData

public void insertData(IndexValue dataValue,
                       int mode)
Insert an index key into the local key set.

Parameters:
dataValue - the index key to be inserted
mode - if INSERT_NORMALLY, then directly insert this key; if INSERT_AS_MIN_KEY, then insert this key as the new min key; if INSERT_AS_MAX_KEY, then insert this key as the new max key

deleteData

public void deleteData(IndexValue dataValue)
Delete an index key from the key set.

Parameters:
dataValue - the index key to be removed

isInRange

public boolean isInRange(java.lang.String value)
Check if the value is in the range


isLessThanRange

public boolean isLessThanRange(java.lang.String value)
Check if the value is less than the range A value is less than the range if it is less than the lower bound of that range


isGreaterThanRange

public boolean isGreaterThanRange(java.lang.String value)
Check if the value is greater than the range


compareTo

public int compareTo(java.lang.String value)
Compare the value with the range >0 for greater =0 for equal <0 for less than


isOverloaded

public boolean isOverloaded()
FIXME: Determine if the node is overload.

Returns:
if overload, return true; otherwise, return false

toString

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

serialize

public java.lang.String serialize()
Get the serialized representation of the ContentInfo.

Returns:
the serialized representation of the ContentInfo