The Robot Application Programming Interface Delegate Project
RAPID Logo

FrameTreeNode Class Reference

A frame-tree is expected to adhere to the following requirements: * Frame names of children of a node are unique. More...

Collaboration diagram for FrameTreeNode:

List of all members.

Public Member Functions

 FrameTreeNode (Frame frame)
 Create a new FrameTreeNode with null parent and assigned frame.
 FrameTreeNode (String frameName)
 Create a new FrameTreeNode with null parent and a new Frame with name frameName.
 FrameTreeNode (String frameName, Matrix4d xfm)
 Create a new FrameTreeNode with null parent and a new Frame with name frameName.
FrameTreeNode set (FrameTreeNode toCopy)
 Set the Frame data to toCopy Only payload data is copied, not children or parent.
FrameTreeNode clone (FrameTreeNode parent)
 Clone node and its offsprings.
Frame getData ()
 for compatibility with c++ api
Frame getFrame ()
FrameTreeNode attachChild (FrameTreeNode node)
 Attach a child node.
FrameTreeNode mergeChild (FrameTreeNode node)
 Merge a child.
FrameTreeNode findChild (String name)
 Find a child with matching name.
boolean removeChild (FrameTreeNode node)
 Remove node from list of children and set it's parent to null.
void detachFromParent ()
void setParent (FrameTreeNode newParent)
 Set the parent of the node.
FrameTreeNode getParent ()
boolean isRoot ()
boolean isLeaf ()
FrameTreeNode getRoot ()
 Search upward in tree to find root.
boolean isAncestorOf (FrameTreeNode node)
List< FrameTreeNodegetAncestry ()
 Get an ordered list of ancestors which begins at root and ends at (and includes) this node.
List< FrameTreeNodegetAncestry (List< FrameTreeNode > store)
FrameTreeNode getLastCommonAncestor (FrameTreeNode that)
 Calculate the last common ancestor.
FrameTreeNode getLastCommonAncestor (FrameTreeNode that, List< FrameTreeNode > thisAncestors, List< FrameTreeNode > thatAncestors)
List< FrameTreeNodegetChildren ()
List< FrameTreeNodegetChildren (boolean sortByName)
int getNumChildren ()
 get the number of direct decendants of this node
int getNumOffspring ()
 Recursively count number of nodes underneath this node.
boolean traverseBreadthFirst (IFrameVisitor visitor)
 Breadth first traversal.
boolean traversePreOrder (IFrameVisitor visitor)
 Depth first, pre-order traversal.
boolean traversePreOrder (IFrameVisitor visitor, boolean sortByName)
boolean traversePostOrder (IFrameVisitor visitor)
 Depth first, post-order traversal.
boolean equals (Object o)
 If the contained Frame name matches this one, return equal.

Protected Member Functions

 FrameTreeNode (FrameTreeNode parent, String frameName)
 Create a new node with the given name and assigned it a parent.
 FrameTreeNode (FrameTreeNode parent, String frameName, Matrix4d xfm)
 Create a new node with the given name, parent and transform.

Protected Attributes

Frame m_data
FrameTreeNode m_parent
final ArrayList< FrameTreeNodem_children = new ArrayList<FrameTreeNode>()

Detailed Description

* Frame names do not contain the character '/'. * Frames are not named ".", "..", nor "...". * The transform has an invertible matrix.

These requirements are not checked explicitly in the FrameTreeNode interface. Only the FrameStore interface explicitly checks these requirements and flags errors if frames are added to the frame-store, that do not meet these assumptions.


Constructor & Destructor Documentation

FrameTreeNode ( Frame  frame)
Parameters:
frame
FrameTreeNode ( String  frameName)
Parameters:
frameNamename for new Frame
FrameTreeNode ( FrameTreeNode  parent,
String  frameName 
) [protected]
Parameters:
parent
frameName

Here is the call graph for this function:

FrameTreeNode ( FrameTreeNode  parent,
String  frameName,
Matrix4d  xfm 
) [protected]
Parameters:
parent
frameName
xfm

Here is the call graph for this function:

FrameTreeNode ( String  frameName,
Matrix4d  xfm 
)
Parameters:
frameNamename for new Frame

Member Function Documentation

FrameTreeNode attachChild ( FrameTreeNode  node)

If the node has an existing parent, it is re-parented to this. XXX FIXME XXX what do we do when a child with the same name is attached? Throw an exception or merge?

Returns:
node if attach was successful, else null

Here is the call graph for this function:

FrameTreeNode clone ( FrameTreeNode  parent)

The new node is becoming a child of parent. Default is NULL, which creates a new root node.

Parameters:
parent
void detachFromParent ( )

Here is the call graph for this function:

boolean equals ( Object  o)

Here is the call graph for this function:

FrameTreeNode findChild ( String  name)
Parameters:
name
Returns:
List<FrameTreeNode> getAncestry ( )
Returns:
List<FrameTreeNode> getAncestry ( List< FrameTreeNode store)

Here is the call graph for this function:

List<FrameTreeNode> getChildren ( )
Returns:
a copy of this node's list of children
List<FrameTreeNode> getChildren ( boolean  sortByName)
Frame getData ( )
Frame getFrame ( )
FrameTreeNode getLastCommonAncestor ( FrameTreeNode  that)
Returns:
null if the nodes are not connected. If either node is a direct ancestor of the other, that node is returned.
FrameTreeNode getLastCommonAncestor ( FrameTreeNode  that,
List< FrameTreeNode thisAncestors,
List< FrameTreeNode thatAncestors 
)

Here is the call graph for this function:

int getNumChildren ( )
Returns:
int getNumOffspring ( )
Returns:
FrameTreeNode getParent ( )
Returns:
parent node
FrameTreeNode getRoot ( )

Linear time.

Here is the call graph for this function:

boolean isAncestorOf ( FrameTreeNode  node)
Returns:
true if this is ancestor of node

Here is the call graph for this function:

boolean isLeaf ( )
Returns:
true if node has no children
boolean isRoot ( )
Returns:
true of parent == null
FrameTreeNode mergeChild ( FrameTreeNode  node)

If a matching child exists, perform a FrameTree.mergeFrameTrees, otherwise, attachChild();

Parameters:
node
Returns:

Here is the call graph for this function:

boolean removeChild ( FrameTreeNode  node)
FrameTreeNode set ( FrameTreeNode  toCopy)
Todo:
Mark: explain the rationale behind this.

Shouldn't this method call something like setFrame, or have a different signature like set(Frame)

Returns:
this

Here is the call graph for this function:

void setParent ( FrameTreeNode  newParent)

This call re-parents the sub-tree. If the node had a parent before, it gets removed from the previous parent's list of children.

Setting the parent to NULL makes the node a root-node.

Here is the call graph for this function:

boolean traverseBreadthFirst ( IFrameVisitor  visitor)

The visitor's up() and down() methods are not called.

Returns:
true only if the visitor has a stop condition and the condition is met

Here is the call graph for this function:

boolean traversePostOrder ( IFrameVisitor  visitor)
Returns:
true only if the visitor has a stop condition and the condition is met

Here is the call graph for this function:

boolean traversePreOrder ( IFrameVisitor  visitor)
Returns:
true only if the visitor has a stop condition and the condition is met
boolean traversePreOrder ( IFrameVisitor  visitor,
boolean  sortByName 
)

Here is the call graph for this function:


Member Data Documentation

final ArrayList<FrameTreeNode> m_children = new ArrayList<FrameTreeNode>() [protected]
Frame m_data [protected]
FrameTreeNode m_parent [protected]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines