uk.ac.lancs.relate.trigger.conditions
Class ZoneCondition

java.lang.Object
  extended by uk.ac.lancs.relate.trigger.conditions.Condition
      extended by uk.ac.lancs.relate.trigger.conditions.ZoneCondition
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ApproachingInZone, OnlyTrackableWithinZone, StillWithinZone, WithinZone, WithinZoneFacing

public class ZoneCondition
extends Condition

A zone condition is a condition which considers spatial relationships between one or more trackables and a zone.

Author:
Sara Streng and Dominique Guinard
Personal Homepage
See Also:
Serialized Form

Constructor Summary
ZoneCondition(java.lang.String id1, java.lang.String deviceId)
          Creates a new trackable condition, meaning a condition which considers spatial relationships between two or more trackables.
 
Method Summary
 void defineActiveTrackable()
          In this case the active trackable is the one specified in the constructor (id1).
 void defineInvolvedTrackables()
          In this case the involved trackable is the one specified in the constructor (id1).
 boolean evaluate()
          Return true if the condition is fulfilled, else false.
 int getNrTrackablesInZone()
          Returns the number of trackables in this application which are currently in this zone.
 Zone getZone()
          Returns the zone of this condition.
 boolean inZone(Trackable trackable)
          Returns true if the given trackable is in this zone
 void setZone(Zone zone)
          Sets the zone of this condition.
 
Methods inherited from class uk.ac.lancs.relate.trigger.conditions.Condition
addInvolvedTrackable, addInvolvedTrackable, getActiveTrackable, getApp, getInvolvedTrackables, getTrackableById, setActiveTrackable, setApp, setInvolvedTrackables
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZoneCondition

public ZoneCondition(java.lang.String id1,
                     java.lang.String deviceId)
Creates a new trackable condition, meaning a condition which considers spatial relationships between two or more trackables. A condition contains a evaluate method, which returns a boolean expression. The evaluate method must not have any parameters since it is called generically. Thus the parameters have to be set in the constructor of the condition object.

Parameters:
id1 - unique id of the active trackable, normally the user
Method Detail

evaluate

public boolean evaluate()
Return true if the condition is fulfilled, else false.

Specified by:
evaluate in class Condition
Returns:
true if the condition is fulfilled, else false

inZone

public boolean inZone(Trackable trackable)
Returns true if the given trackable is in this zone

Parameters:
trackable - trackable
Returns:
true if trackable is in zone

getNrTrackablesInZone

public int getNrTrackablesInZone()
Returns the number of trackables in this application which are currently in this zone.

Returns:
number of trackables in this zone

getZone

public Zone getZone()
Returns the zone of this condition.

Returns:
zone

setZone

public void setZone(Zone zone)
Sets the zone of this condition.

Parameters:
zone - zone

defineInvolvedTrackables

public void defineInvolvedTrackables()
In this case the involved trackable is the one specified in the constructor (id1).

Specified by:
defineInvolvedTrackables in class Condition

defineActiveTrackable

public void defineActiveTrackable()
In this case the active trackable is the one specified in the constructor (id1).

Specified by:
defineActiveTrackable in class Condition