lime.motes
Class MoteLimeTemplate

java.lang.Object
  extended bylime.LimeTemplate
      extended bylime.motes.MoteLimeTemplate

public class MoteLimeTemplate
extends LimeTemplate

This class, MotesLimeTemplate, is used to wrap the tuple along with the extra fields to be matched, e.g., the current, destination, and tuple id fields. In addition to the LimeTemplate, this implementation supports mote id localization, necessary to specify a mote as destination of the pattern matching request.

Version:
1.0
Author:
Carlo Curino, Matteo Giani, Marco Giorgetta, Alessandro Giusti
See Also:
LimeTuple, LimeTupleSpace, LimeTemplate

Field Summary
private  int freshness
          The freshness of the data that is required.
private static int FRESHNESS_UNSPECIFIED
          Constant that indicates the value of the freshness when it is unspec.
private  MoteID mote
          The ID of the mote.
 
Fields inherited from class lime.LimeTemplate
 
Constructor Summary
MoteLimeTemplate(lights.interfaces.ITuple t)
          Construct a new LimeTemplate with the cur, dest, freshness and tuple id formal.
MoteLimeTemplate(Location cur, AgentLocation dest, LimeTupleID id, lights.interfaces.ITuple t)
          Construct a new MotesLimeTemplate.
MoteLimeTemplate(Location cur, AgentLocation dest, MoteID mote, int f, LimeTupleID id, lights.interfaces.ITuple t)
          Construct a new MotesLimeTemplate.
 
Method Summary
(package private) static lights.interfaces.ITuple cloneTuple(lights.interfaces.ITuple t)
          Helper method used to clone a tuple.
(package private) static lights.interfaces.ITuple cloneTuple(lights.interfaces.ITuple t, int start, int end)
          Helper method for cloning a tuple
 int getFreshness()
          Getter of the freshness of the template.
 MoteID getMoteid()
          Getter for the moteID.
 MoteLimeTemplate insertMoteID()
          Used to insert to mote id into the tuple that will be used for pattern matching.
 boolean isFreshnessSet()
          This method is used to determine if the freshness is required or unspecified.
 java.lang.String toString()
           
 
Methods inherited from class lime.LimeTemplate
getCurrent, getDestination, getDestination, getID, getID, getTuple, setCurrent, setTuple
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FRESHNESS_UNSPECIFIED

private static final int FRESHNESS_UNSPECIFIED
Constant that indicates the value of the freshness when it is unspec.

See Also:
Constant Field Values

mote

private MoteID mote
The ID of the mote.


freshness

private int freshness
The freshness of the data that is required.

Constructor Detail

MoteLimeTemplate

public MoteLimeTemplate(Location cur,
                        AgentLocation dest,
                        MoteID mote,
                        int f,
                        LimeTupleID id,
                        lights.interfaces.ITuple t)
Construct a new MotesLimeTemplate.

Parameters:
cur - current location
dest - destination location
mote - id of the mote
f - the freshness required for the sensing.
id - tuple id, or null for formal
t - the tuple

MoteLimeTemplate

public MoteLimeTemplate(Location cur,
                        AgentLocation dest,
                        LimeTupleID id,
                        lights.interfaces.ITuple t)
Construct a new MotesLimeTemplate.

Parameters:
cur - current location
dest - destination location
id - tuple id, or null for formal
t - the tuple

MoteLimeTemplate

public MoteLimeTemplate(lights.interfaces.ITuple t)
Construct a new LimeTemplate with the cur, dest, freshness and tuple id formal.

Parameters:
t - the tuple
Method Detail

getMoteid

public MoteID getMoteid()
Getter for the moteID.

Returns:
The MoteID of the template.

insertMoteID

public MoteLimeTemplate insertMoteID()
Used to insert to mote id into the tuple that will be used for pattern matching. This mechanism allows to exploit lime's matching of the tuple for checking the MoteID as well.


toString

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

getFreshness

public int getFreshness()
Getter of the freshness of the template.

Returns:
an int value indicating the freshness of the tempalate.

isFreshnessSet

public boolean isFreshnessSet()
This method is used to determine if the freshness is required or unspecified.

Returns:
true if the freshness is unspecified, false otherwise.

cloneTuple

static lights.interfaces.ITuple cloneTuple(lights.interfaces.ITuple t)
Helper method used to clone a tuple.

Parameters:
t - the tuple to be cloned.
Returns:
a deeply cloned tuple.

cloneTuple

static lights.interfaces.ITuple cloneTuple(lights.interfaces.ITuple t,
                                           int start,
                                           int end)
Helper method for cloning a tuple

Parameters:
t - the tuple to be cloned.
start - the field to start the cloning from.
end - the field to end the cloning to.
Returns:
the deeply cloned tuple.