Class TreeAgentState

java.lang.Object
  extended by TreeAgentState
All Implemented Interfaces:
ILogicVarBundle, IMsg

public class TreeAgentState
extends java.lang.Object
implements ILogicVarBundle, IMsg

Discrete state for tree re-arrangement agent

Future work -- currently the "target topology information" specific to "Formation Morphing Algorithm" is combined with this class. This should not be the case. The two should be separated, and Formation Morphing Algorithm should have its own class to store this info.

Since:
1.0

Field Summary
static int ROUND_ATTACH
          faked enum for differentiating rounds
static int ROUND_PROPOSE_NEW
          faked enum for differentiating rounds
static int ROUND_SET_PARLESS
          faked enum for differentiating rounds
static int ROUND_UPDATE_DEPTH
          faked enum for differentiating rounds
 
Constructor Summary
TreeAgentState()
          Sets depth estimate to zero, parentId to -1, and m_bDfsFinished to false
TreeAgentState(int nParentId, boolean bDfsFinished)
          Sets depth estimate to zero.
TreeAgentState(int nDepth, int nParentId, boolean bDfsFinished)
           
TreeAgentState(TreeAgentState src)
          Copy constructor - copies everything target information copied as well (valid if valid in src)
 
Method Summary
 ILogicVarBundle getAlgVars()
          Gets logic vars specific to this particular algorithm implementing the tree connectivity protocol
 java.lang.Boolean getBoolVar(java.lang.Object refObject)
          gets a Boolean (wrapping a boolean) referred to by an object.
 int getCurrRound()
          accessor for current round
 int getDepthEst()
           
 boolean getDfsFinished()
           
 int getFirstVisit()
           
 int getId()
          Gets unique Id of this agent
 java.lang.Integer getIntVar(java.lang.Object refObject)
          gets an Integer (wrapping an int) referred to by an object.
 int getLastVisit()
           
 boolean getParDepLess()
           
 int getParentId()
           
 int getParentProp()
           
 int getParentsPar()
           
 int getTargDepth()
           
 int getTargetDepth()
          returns depth for tree topology storage
 int getTargNChildren()
           
 TreeAgentState incrRound()
          Increment round counter (e.g which round of the algorithm we're on) This is essential for correct negotiation of constraint tree topology re-arrangements
 boolean insertBoolVar(java.lang.Object refObject, boolean bValue)
          inserts an boolean value (see getBoolVar).
 boolean insertIntVar(java.lang.Object refObject, int nValue)
          inserts an integer value (see getIntVar(java.lang.Object)).
 boolean isAncest(TreeAgentState stateB)
           
 TreeAgentState makeCopy()
          makes a copy and returns it
 void removeVar(java.lang.Object refObject)
          Removes any values indexed by refObject
 void resetDepthEst()
           
 void setAlgVars(ILogicVarBundle algVars)
          Sets logic vars specific to this particular algorithm implementing the tree connectivity protocol
 void setDepthEst(int nNewDepth)
          Not the preferred way to do this
 void setDfsFinished(boolean bFinished)
           
 void setId(int nId)
          Sets unique Id of this agent
 void setParDepLess(boolean bParDepLess)
           
 void setParDepLess(TreeAgentState stateParent)
           
 void setParentId(int nParentId)
           
 void setParentProp(int nParentProp)
           
 void setParentsPar(int nParentsParent)
           
 TreeAgentState setTargetConfig(int nDepthFin, int nFirst, int nLast, int nNumChilds)
          Sets discrete (topological) component of target config info for this state
 TreeAgentState setTargetDepth(int nDepth)
           
 void updateDepthEst(TreeAgentState stateParent)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROUND_ATTACH

public static final int ROUND_ATTACH
faked enum for differentiating rounds

See Also:
Constant Field Values

ROUND_UPDATE_DEPTH

public static final int ROUND_UPDATE_DEPTH
faked enum for differentiating rounds

See Also:
Constant Field Values

ROUND_SET_PARLESS

public static final int ROUND_SET_PARLESS
faked enum for differentiating rounds

See Also:
Constant Field Values

ROUND_PROPOSE_NEW

public static final int ROUND_PROPOSE_NEW
faked enum for differentiating rounds

See Also:
Constant Field Values
Constructor Detail

TreeAgentState

public TreeAgentState(int nDepth,
                      int nParentId,
                      boolean bDfsFinished)
Parameters:
nDepth - initial depth estimate (see 2006i)
nParentId - initial parent id
bDfsFinished - whether depth first search to determine parent ids has finished for this node and all its children

TreeAgentState

public TreeAgentState(int nParentId,
                      boolean bDfsFinished)

Sets depth estimate to zero.

Final target configuration and topology information need to be set seperately.

Parameters:
nParentId - initial parent id
bDfsFinished - whether depth first search to determine parent ids has finished for this node and all its children

TreeAgentState

public TreeAgentState()

Sets depth estimate to zero, parentId to -1, and m_bDfsFinished to false

Final target configuration and topology information need to be set seperately.


TreeAgentState

public TreeAgentState(TreeAgentState src)
Copy constructor - copies everything target information copied as well (valid if valid in src)

Parameters:
src - makes new copies of everything from this state
Method Detail

getAlgVars

public ILogicVarBundle getAlgVars()
Gets logic vars specific to this particular algorithm implementing the tree connectivity protocol


setAlgVars

public void setAlgVars(ILogicVarBundle algVars)
Sets logic vars specific to this particular algorithm implementing the tree connectivity protocol


makeCopy

public TreeAgentState makeCopy()
makes a copy and returns it

Specified by:
makeCopy in interface ILogicVarBundle
Specified by:
makeCopy in interface IMsg

getIntVar

public java.lang.Integer getIntVar(java.lang.Object refObject)
gets an Integer (wrapping an int) referred to by an object. returns null if refObject is of invalid type or indexes an invalid logic var. Note: The original specification only allowed boolean variables in this place. Obviously some applications may want to use collections of boolean variables to represent integers over a finite fixed range, or rationals with finite fixed precision over a finite fixed range. This function is merely provided as a shortcut towards this end.

Specified by:
getIntVar in interface ILogicVarBundle

removeVar

public void removeVar(java.lang.Object refObject)
Removes any values indexed by refObject

Specified by:
removeVar in interface ILogicVarBundle
Parameters:
refObject - remove values associated with this.

insertIntVar

public boolean insertIntVar(java.lang.Object refObject,
                            int nValue)
inserts an integer value (see getIntVar(java.lang.Object)). Returns false if this insert was not permitted

Specified by:
insertIntVar in interface ILogicVarBundle
See Also:
getIntVar(java.lang.Object)

getBoolVar

public java.lang.Boolean getBoolVar(java.lang.Object refObject)
gets a Boolean (wrapping a boolean) referred to by an object. returns null if refObject is of invalid type or indexes an invalid logic var.

Specified by:
getBoolVar in interface ILogicVarBundle

insertBoolVar

public boolean insertBoolVar(java.lang.Object refObject,
                             boolean bValue)
inserts an boolean value (see getBoolVar). Returns fals if this insert was not permitted

Specified by:
insertBoolVar in interface ILogicVarBundle
See Also:
getBoolVar(java.lang.Object)

getId

public int getId()
Description copied from interface: ILogicVarBundle
Gets unique Id of this agent

Specified by:
getId in interface ILogicVarBundle

setId

public void setId(int nId)
Description copied from interface: ILogicVarBundle
Sets unique Id of this agent

Specified by:
setId in interface ILogicVarBundle

getDfsFinished

public boolean getDfsFinished()

setDfsFinished

public void setDfsFinished(boolean bFinished)

getDepthEst

public int getDepthEst()

updateDepthEst

public void updateDepthEst(TreeAgentState stateParent)

setDepthEst

public void setDepthEst(int nNewDepth)
Not the preferred way to do this


resetDepthEst

public void resetDepthEst()

getParentId

public int getParentId()

setParentId

public void setParentId(int nParentId)

getParentProp

public int getParentProp()

setParentProp

public void setParentProp(int nParentProp)

getParDepLess

public boolean getParDepLess()

setParDepLess

public void setParDepLess(boolean bParDepLess)

setParDepLess

public void setParDepLess(TreeAgentState stateParent)

getParentsPar

public int getParentsPar()

setParentsPar

public void setParentsPar(int nParentsParent)

incrRound

public TreeAgentState incrRound()
Increment round counter (e.g which round of the algorithm we're on) This is essential for correct negotiation of constraint tree topology re-arrangements

Returns:
this

getCurrRound

public int getCurrRound()
accessor for current round


getTargetDepth

public int getTargetDepth()
returns depth for tree topology storage

Returns:
depth for tree topology storage

setTargetDepth

public TreeAgentState setTargetDepth(int nDepth)
Parameters:
nDepth - new target depth (do not confuse with depth estimate)
Returns:
this

isAncest

public boolean isAncest(TreeAgentState stateB)
Parameters:
stateB - state to compare to
Returns:
whether stateB is an descendent of this in the final tree

setTargetConfig

public TreeAgentState setTargetConfig(int nDepthFin,
                                      int nFirst,
                                      int nLast,
                                      int nNumChilds)
Sets discrete (topological) component of target config info for this state

Parameters:
nDepthFin - final depth in target config
nFirst - used by IsAncest to check ancestor relations -- see paper
nLast - used by IsAncest to check ancestor relations -- see paper
Returns:
this

getFirstVisit

public int getFirstVisit()

getLastVisit

public int getLastVisit()

getTargDepth

public int getTargDepth()

getTargNChildren

public int getTargNChildren()