com.ibm.tspaces.examples.handler
Class StaleTimestamp

java.lang.Object
  |
  +--com.ibm.tspaces.Field
        |
        +--com.ibm.tspaces.examples.handler.StaleTimestamp

public class StaleTimestamp
extends Field

This class demonstrates how to subclass the Field method for exotic matching behavior. It is used to compare a timestamp in a Tuple template against the Tuples in the database and select all the stale tuples.

Author:
Pete Wyckoff, John Thomas
See Also:
Field, TupleSpace, Serialized Form

Fields inherited from class com.ibm.tspaces.Field
isFormal, theName, theType, theTypeString, theValue
 
Constructor Summary
StaleTimestamp(long newval)
          construct a StaleTimestamp, only way to do it for now if via a single long
 
Method Summary
 boolean matches(Field f)
          match based on the less than criterion.
 
Methods inherited from class com.ibm.tspaces.Field
assign, clone, formal, getName, getType, getValue, isFormal, main, makeField, name, setFormal, setFormal, setName, setType, setValue, toString, type, value
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StaleTimestamp

public StaleTimestamp(long newval)
               throws TupleSpaceException
construct a StaleTimestamp, only way to do it for now if via a single long
Parameters:
newval - the long
Throws:
TupleSpaceException - if there is aproblem creating the field
Method Detail

matches

public boolean matches(Field f)
match based on the less than criterion. This Field is used to select Tuples whose Timestamp is older than the current time. It is important to use this Field value only in the template so that it be the object that is being compared to the value in the real tuple.
Overrides:
matches in class Field
Parameters:
f - the other field --- the one that we are checking against
Returns:
true if the other fields value is less than this ones and the other is a Long