BEA Systems, Inc.

com.bea.rfid.workflow.util
Class Directionality

java.lang.Object
  extended by com.bea.rfid.workflow.util.Directionality

public class Directionality
extends Object

Class to determine direction of tags moving between two points. This class refers to the two points as 'point A' and 'point B'. A tag's direction is determined when it is seen on one point, seen on the other point and disappears from the original point. Detailed description of the algorithm and state diagram are available at [link].


Field Summary
protected  Set m_addReportsPointA
           
protected  Set m_addReportsPointB
           
protected  Set m_deleteReportsPointA
           
protected  Set m_deleteReportsPointB
           
 
Constructor Summary
Directionality(long staleTagTimeout, Timer timer, Set addReportsPointA, Set deleteReportsPointA, Set addReportsPointB, Set deleteReportsPointB)
          Constructor.
 
Method Summary
 void additionAtPointA(List tagList)
          Accepts a list of tags seen at Point A and updates the state of the tags.
 void additionAtPointB(List tagList)
          Accepts a list of tags seen at Point B and updates the state of the tags.
 void deletionAtPointA(List tagList)
          Accepts a list of tags that disappeared from Point A and updates the state of the tags.
 void deletionAtPointB(List tagList)
          Accepts a list of tags that disappeared from Point B and updates the state of the tags.
 long getStaleTagTimeout()
          Returns the stale tag timeout set on this instance of directionality.
 boolean isRunning()
          Returns boolean indicating if this is in the state in which it processes inputs to determine directionality.
 void processECReports(com.connecterra.ale.api.ECReports ecReports)
          Looks in the input ECReports to find out which tags were seen or disappeared from each point to determine the directionality of tags.
 void registerAtoBObserver(DirectionObserver directionAtoBObserver)
          Registers an observer that gets notified when tags are detected moving in A to B direction.
 void registerBtoAObserver(DirectionObserver directionBtoAObserver)
          Registers an observer that gets notified when tags are detected moving in B to B direction.
 void shutdown()
          Releases all resources used by this directionality instance.
 void start()
          Moves this directionality instance to the state in which it processes inputs to determine directionality.
 void stop()
          Moves this directionality instance to the state in which it does not process inputs to determine directionality.
 void unregisterAtoBObserver(DirectionObserver directionAtoBObserver)
          Removes the given observer from the list of observers that get notified when tags move in A to B direction.
 void unregisterBtoAObserver(DirectionObserver directionBtoAObserver)
          Removes the given observer from the list of observers that get notified when tags move in B to A direction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_addReportsPointA

protected Set m_addReportsPointA

m_deleteReportsPointA

protected Set m_deleteReportsPointA

m_addReportsPointB

protected Set m_addReportsPointB

m_deleteReportsPointB

protected Set m_deleteReportsPointB
Constructor Detail

Directionality

public Directionality(long staleTagTimeout,
                      Timer timer,
                      Set addReportsPointA,
                      Set deleteReportsPointA,
                      Set addReportsPointB,
                      Set deleteReportsPointB)
Constructor.

Parameters:
staleTagTimeout - the duration in milliseconds for which a tag's state is kept once it is seen and disappeared from just one point. This value must be greater than or equal to zero.
timer - java.util.Timer object to schedule tasks for later execution
addReportsPointA - point A addition report names
deleteReportsPointA - point A deletion report names
addReportsPointB - point B addition report names
deleteReportsPointB - point B deletion report names
Throws:
IllegalArgumentException - if stale tag timeout is <= 0 or timer is null
Method Detail

getStaleTagTimeout

public long getStaleTagTimeout()
Returns the stale tag timeout set on this instance of directionality. This is the duration in milliseconds for which a tag's state will be kept once a tag is seen and disappeared from just one point.

Returns:
the duration in milliseconds for which a tag's state will be kept

start

public void start()
Moves this directionality instance to the state in which it processes inputs to determine directionality. Any inputs it receives when it is not in this state are ignored.


stop

public void stop()
Moves this directionality instance to the state in which it does not process inputs to determine directionality. Any inputs it receives when it is in this state are ignored.


isRunning

public boolean isRunning()
Returns boolean indicating if this is in the state in which it processes inputs to determine directionality. Returns true if it is processing inputs, false otherwise.

Returns:
boolean indicating if this is in the state in which it processes inputs to determine directionality. Returns true if it is processing inputs, false otherwise.

registerAtoBObserver

public void registerAtoBObserver(DirectionObserver directionAtoBObserver)
Registers an observer that gets notified when tags are detected moving in A to B direction.

Parameters:
directionAtoBObserver - observer that should be notified of tags moving in A to B direction

unregisterAtoBObserver

public void unregisterAtoBObserver(DirectionObserver directionAtoBObserver)
Removes the given observer from the list of observers that get notified when tags move in A to B direction.

Parameters:
directionAtoBObserver - observer that is to be removed from list of observers

registerBtoAObserver

public void registerBtoAObserver(DirectionObserver directionBtoAObserver)
Registers an observer that gets notified when tags are detected moving in B to B direction.

Parameters:
directionBtoAObserver - observer that should be notified of tags moving in B to A direction

unregisterBtoAObserver

public void unregisterBtoAObserver(DirectionObserver directionBtoAObserver)
Removes the given observer from the list of observers that get notified when tags move in B to A direction.

Parameters:
directionBtoAObserver - observer that is to be removed from list of observers

processECReports

public void processECReports(com.connecterra.ale.api.ECReports ecReports)
Looks in the input ECReports to find out which tags were seen or disappeared from each point to determine the directionality of tags. The input ECReports must have the addition/deletion reports configured with this or it will be ignored.

Parameters:
ecReports - ECReports with addition and deletion reports for point A or B
Throws:
IllegalStateException - if no addition and deletion reports are configured

additionAtPointA

public void additionAtPointA(List tagList)
Accepts a list of tags seen at Point A and updates the state of the tags.

Parameters:
tagList - list with the tags seen at Point A

deletionAtPointA

public void deletionAtPointA(List tagList)
Accepts a list of tags that disappeared from Point A and updates the state of the tags.

Parameters:
tagList - list with the tags that disappeared from Point A

additionAtPointB

public void additionAtPointB(List tagList)
Accepts a list of tags seen at Point B and updates the state of the tags.

Parameters:
tagList - list with the tags seen at Point B

deletionAtPointB

public void deletionAtPointB(List tagList)
Accepts a list of tags that disappeared from Point B and updates the state of the tags.

Parameters:
tagList - list with the tags that disappeared from Point B

shutdown

public void shutdown()
Releases all resources used by this directionality instance. All timer tasks initiated by this are cancelled.


Documentation is available at
${DOCSWEBROOT}
Copyright 2007 BEA Systems Inc.