|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A Xholon is a node within a hierarchical tree structure, and builds on the capabilities of tree nodes. A tree node is a node in a tree. It has one parent (none if it's the root), and may have one or more children, and one or more siblings. A Xholon is both a whole, and a part of some other Xholon, at the same time. A Xholon is an instance of a IXholonClass. A Xholon can be an active object, a passive object, a container, or any combination of these three, as defined by its IXholonClass.
Field Summary | |
static int |
DEFAULT_SIZE_MSG_Q
|
static int |
NINCLUDE_PSC
|
static int |
NINCLUDE_PSx
|
static int |
NINCLUDE_PxC
|
static int |
NINCLUDE_Pxx
|
static int |
NINCLUDE_xSC
|
static int |
NINCLUDE_xSx
|
static int |
NINCLUDE_xxC
|
static int |
NINCLUDE_xxx
|
Method Summary | |
void |
act()
Do some action during this time step. |
void |
appendChild(IXholon newParentNode)
Append this node as the last child of its new parent node. |
IXholon |
appendChild(java.lang.String xhClassName,
java.lang.String roleName)
Create a new child, and append it as the last child of this node. |
IXholon |
appendChild(java.lang.String xhClassName,
java.lang.String roleName,
java.lang.String implName)
Create a new child, and append it as the last child of this node. |
void |
cleanup()
Do any required cleanup work once the application has stopped executing. |
void |
configure()
Perform some action, typically once at start up; MAY be overridden. |
int |
configure(java.lang.String instructions,
int instructIx)
Configure something based on a configure instruction. |
int |
createStructure(java.util.Vector containmentData,
int myIx,
ITreeNodeFactory factory,
IInheritanceHierarchy inherHier)
Recursively create this Xholon and its internal part structure, as nodes within the overall composite structure tree. |
void |
decVal(double decAmount)
Decrement an internal double value by a specified amount. |
void |
decVal(int decAmount)
Decrement an internal int value by a specified amount. |
int |
depth()
Get the number of ancestors of this node, excluding this node itself. |
void |
draw()
Draw a 2D representation of the tree, using inorder traversal. |
java.util.Vector |
getChildNodes(boolean deep)
Get all children of this node. |
IXholon |
getFirstChild()
Get first (leftmost) child of this node. |
IXholon |
getFirstSibling()
Get first (leftmost) sibling. |
int |
getId()
Get ID of this TreeNode instance. |
IXholon |
getLastChild()
Get last (rightmost) child. |
IXholon |
getLastSibling()
Get last (rightmost) sibling. |
java.lang.String |
getName()
Get name, unique within this application, of this Xholon instance. |
java.util.Vector |
getNeighbors(int distance,
int include,
java.lang.String excludeBecName)
Get neighbors. |
IXholon |
getNextSibling()
Get next (right) sibling of this node. |
IXholon |
getNthChild(int n,
boolean deep)
Get the nth child of this node, where 0 <= n < number of children. |
IXholon |
getNthSibling(int n)
Get nth sibling. |
int |
getNumChildren(boolean deep)
Get number of children that this node has. |
int |
getNumSiblings()
Get number of siblings. |
IXholon |
getParentNode()
Get parent of this node. |
IXholon |
getPort(int portNum)
Get the port that corresponds to this index (0 indexed). |
IXholon |
getPreviousSibling()
Get previous (left) sibling of this node. |
java.lang.String |
getRoleName()
Get name of the role played by this Xholon within a specific context. |
IXholon |
getRootNode()
Get root of the tree that this node is a part of. |
java.util.Vector |
getSiblings()
Get siblings. |
java.lang.String |
getUid()
Get globally unique ID. |
boolean |
getVal_boolean()
Get the value of a "boolean" maintained by this xholon instance. |
byte |
getVal_byte()
Get the value of a "byte" maintained by this xholon instance. |
char |
getVal_char()
Get the value of a "char" maintained by this xholon instance. |
double |
getVal_double()
Get the value of a "double" maintained by this xholon instance. |
float |
getVal_float()
Get the value of a "float" maintained by this xholon instance. |
int |
getVal_int()
Get the value of a "int" maintained by this xholon instance. |
long |
getVal_long()
Get the value of a "long" maintained by this xholon instance. |
java.lang.Object |
getVal_Object()
Get the value of a "Object" maintained by this xholon instance. |
short |
getVal_short()
Get the value of a "short" maintained by this xholon instance. |
java.lang.String |
getVal_String()
Get the value of a "String" maintained by this xholon instance. |
double |
getVal()
Get the value of a "double" maintained by this xholon instance. |
IXholonClass |
getXhc()
Get the IXholonClass to which this Xholon instance is a member. |
int |
getXhcId()
Get the ID of the IXholonClass to which this Xholon instance is a member. |
java.lang.String |
getXhcName()
Get the name of the IXholonClass to which this Xholon instance is a member. |
int |
getXhType()
Get the Xholon type, as known to this Xholon's IXholonClass. |
java.lang.String |
handleNodeSelection()
Handle selection of a tree node by a user, as when a person clicks on a JTree node in the default viewer. |
boolean |
hasAncestor(java.lang.String tnName)
Does this instance of Xholon have the specified node as one of its ancestors (parent, grandparent, etc.), within its containment tree. |
boolean |
hasChildNodes()
Does this node have a first (left) child. |
boolean |
hasChildOrSiblingNodes()
Does this node have either a first child or a next sibling or both. |
boolean |
hasNextSibling()
Does this node have a next (right) sibling. |
boolean |
hasParentNode()
Does this node have a parent. |
int |
height()
Get number of levels in hierarchical tree. |
void |
incVal(double incAmount)
Increment an internal double value by a specified amount. |
void |
incVal(int incAmount)
Increment an internal int value by a specified amount. |
void |
initialize()
Initialize the tree node. |
void |
initStatics()
Initialize any static varibles that can't be statically initialized. |
void |
inOrderPrint(int level)
In-order print. |
void |
insertAfter(IXholon newPreviousSibling)
Insert this node after its new previous sibling node. |
void |
insertBefore(IXholon newNextSibling)
Insert this node before its new next sibling node. |
void |
insertFirstChild(IXholon newParentNode)
Insert this node as the first child of its new parent node. |
boolean |
isActiveObject()
Is this xholon or xholon class an Active Object? |
boolean |
isBound(IXholon port)
Is this port bound to anything? If a port is bound, then it will be possible for the local IXholon to send a message to, or get/set a val on, a remote IXholon. |
boolean |
isContainer()
Is this xholon or xholon class a Container? |
boolean |
isExternal()
Is this an external node (no child or siblings). |
boolean |
isInternal()
Is this an internal node (has child and/or siblings). |
boolean |
isLeaf()
Is this a leaf node (has no child, but may have siblings). |
boolean |
isPassiveObject()
Is this xholon or xholon class a Passive Object? |
boolean |
isRootNode()
Is this the root node of the tree (does it have a parent). |
void |
performActivity(int activityId)
Do the activity identified by the activityId. |
void |
performActivity(int activityId,
IMessage msg)
Do the UML2 Activity identified by the activityId. |
boolean |
performBooleanActivity(int activityId)
Do the UML2 Activity identified by the activityId. |
boolean |
performBooleanActivity(IXholon activity)
Perform an activity including the entire activity subtree. |
double |
performDoubleActivity(IXholon activity)
Perform an activity including the entire activity subtree. |
boolean |
performGuard(int activityId,
IMessage msg)
Do the UML2 Activity identified by the activityId. |
void |
performVoidActivity(IXholon activity)
Perform an activity including the entire activity subtree. |
void |
postAct()
Do any required work after doing the main action during a time step. |
void |
postConfigure()
Perform some action, typically once at start up; MAY be overridden. |
void |
postOrderPrint(int level)
Post-order print. |
void |
postReconfigure()
Post-reconfigure. |
void |
preAct()
Do any setup required before doing the main action during a time step. |
void |
preConfigure()
Perform some action, typically once at start up; MAY be overridden. |
void |
preOrderPrint(int level)
Pre-order print. |
void |
preReconfigure()
Pre-Reconfigure, such as at the start of a new GP generation. |
void |
print(java.lang.Object obj)
Write an object to standard out. |
void |
println(java.lang.Object obj)
Write an object to standard out, terminated with an end-of-line. |
void |
processMessageQ()
Process ROOM/UML2 messages that are on the message queue. |
void |
processReceivedMessage(Message msg)
Process a received ROOM/UML2 message taken from the message queue. |
void |
reconfigure()
Reconfigure, such as at the start of a new GP generation. |
void |
remove()
Remove this node from the model, by recursively removing all children and next siblings, and by then returning it to the factory. |
void |
removeChild()
Detach this node from its parent and from any siblings. |
void |
sendMessage(int signal,
java.lang.Object data,
IXholon sender)
Send a ROOM/UML2 message to a receiving Xholon instance. |
void |
sendMessage(int signal,
java.lang.Object data,
IXholon sender,
int index)
Send a ROOM/UML2 message to a receiving Xholon instance. |
void |
sendMessage(Message msg)
Send a ROOM/UML2 message to a receiving Xholon instance. |
int |
setAttributeVal(java.lang.String attrName,
java.lang.String attrVal)
Set the value of an attribute, given it's name. |
void |
setFirstChild(IXholon treeNode)
Set first (leftmost) child of this node. |
void |
setId(int id)
Set the ID of this TreeNode instance. |
void |
setNextSibling(IXholon treeNode)
Set next (right) sibling of this node. |
void |
setParentChildLinks(IXholon parent)
Set parent child links. |
void |
setParentNode(IXholon treeNode)
Set parent of this node. |
void |
setParentSiblingLinks(IXholon previousSibling)
Set parent sibling links. |
void |
setPorts()
Set ports, by creating an array of ports. |
void |
setRoleName(java.lang.String roleName)
Set name of the role played by this Xholon within a specific context. |
void |
setUid(java.lang.String uid)
Set globally unique ID. |
void |
setVal(boolean val)
Set the value of a "boolean" maintained by this xholon instance. |
void |
setVal(byte val)
Set the value of a "byte" maintained by this xholon instance. |
void |
setVal(char val)
Set the value of a "char" maintained by this xholon instance. |
void |
setVal(double val)
Set the value of a "double" maintained by this xholon instance. |
void |
setVal(float val)
Set the value of a "float" maintained by this xholon instance. |
void |
setVal(int val)
Set the value of a "int" maintained by this xholon instance. |
void |
setVal(long val)
Set the value of a "long" maintained by this xholon instance. |
void |
setVal(java.lang.Object val)
Set the value of a "Object" maintained by this xholon instance. |
void |
setVal(short val)
Set the value of a "short" maintained by this xholon instance. |
void |
setVal(java.lang.String val)
Set the value of a "String" maintained by this xholon instance. |
int |
setVariableValue(java.lang.String instructions,
int instructIx)
Set the value of a variable using reflection. |
void |
setXhc(IXholonClass xhcNode)
Set the IXholonClass to which this Xholon instance belongs. |
void |
swapNode(IXholon otherNode)
Swap this node with otherNode. |
void |
terminate()
Terminate a UML2 state machine, and optionally terminate the xholon that owns the state machine. |
int |
treeSize()
Get number of nodes in tree. |
void |
writeXml(int level,
java.io.Writer fw)
Write self to a file as XML. |
Field Detail |
public static final int DEFAULT_SIZE_MSG_Q
public static final int NINCLUDE_xxx
public static final int NINCLUDE_xxC
public static final int NINCLUDE_xSx
public static final int NINCLUDE_xSC
public static final int NINCLUDE_Pxx
public static final int NINCLUDE_PxC
public static final int NINCLUDE_PSx
public static final int NINCLUDE_PSC
Method Detail |
public void remove()
public IXholon getParentNode()
public void setParentNode(IXholon treeNode)
treeNode
- This node's new parent.public IXholon getFirstChild()
public void setFirstChild(IXholon treeNode)
treeNode
- This node's new first child.public IXholon getNextSibling()
public void setNextSibling(IXholon treeNode)
treeNode
- This node's new next sibling.public IXholon getPreviousSibling()
public IXholon getRootNode()
public void setParentChildLinks(IXholon parent)
parent
- This node's new parent.public void setParentSiblingLinks(IXholon previousSibling)
previousSibling
- This node's new previous sibling.public int setAttributeVal(java.lang.String attrName, java.lang.String attrVal)
attrName
- The name of an attribute.attrVal
- The intended value of the attribute.
public void removeChild()
public void insertAfter(IXholon newPreviousSibling)
newPreviousSibling
- New previous sibling of this node.public void insertBefore(IXholon newNextSibling)
newNextSibling
- New next sibling of this node.public void insertFirstChild(IXholon newParentNode)
newParentNode
- New parent of this node.public void appendChild(IXholon newParentNode)
newParentNode
- New parent of this node.public void swapNode(IXholon otherNode)
otherNode
- The node to swap position with.public int depth()
public int height()
public int treeSize()
public boolean isRootNode()
public boolean isExternal()
public boolean isInternal()
public boolean isLeaf()
public java.util.Vector getChildNodes(boolean deep)
deep
- If true then return entire nested subtree, if false return only immediate children.
public IXholon getNthChild(int n, boolean deep)
n
- The index of the child being requested.deep
- If true then return entire nested subtree, if false return only immediate children.
public boolean hasParentNode()
public boolean hasChildNodes()
public boolean hasNextSibling()
public boolean hasChildOrSiblingNodes()
public int getNumChildren(boolean deep)
deep
- If true then return entire nested subtree, if false return only immediate children.
public IXholon getLastChild()
public IXholon getLastSibling()
public IXholon getFirstSibling()
public java.util.Vector getSiblings()
public IXholon getNthSibling(int n)
n
- The index of the sibling being requested.
public int getNumSiblings()
public java.util.Vector getNeighbors(int distance, int include, java.lang.String excludeBecName)
distance
- How far within the tree to search for neighbors.include
- Whether to include (P)arent and/or (S)iblings and/or (C)hildren.excludeBecName
- Name of a XholonClass, used to limit the scope of the returned Vector.
TODO this uses an IXholon method
public void preOrderPrint(int level)
level
- Level in the tree, where the root node is level 0.public void inOrderPrint(int level)
level
- Level in the tree, where the root node is level 0.public void postOrderPrint(int level)
level
- Level in the tree, where the root node is level 0.public void writeXml(int level, java.io.Writer fw)
level
- Level in the tree, where the root node is level 0.fw
- The file to write to.public void draw()
public void initialize()
public void initStatics()
public void preConfigure()
public void configure()
public int configure(java.lang.String instructions, int instructIx)
instructions
- A String that contains a configure instruction.instructIx
- An index into the instructions String.
public void postConfigure()
public void preReconfigure()
public void reconfigure()
public void postReconfigure()
public void preAct()
public void act()
public void postAct()
public void cleanup()
public int getId()
public void setId(int id)
id
- The ID of this TreeNode.public void print(java.lang.Object obj)
obj
- The object to write.public void println(java.lang.Object obj)
obj
- The object to write.public java.lang.String getName()
public IXholonClass getXhc()
public int getXhcId()
public java.lang.String getXhcName()
public void setXhc(IXholonClass xhcNode)
xhcNode
- The IXholonClass.public int getXhType()
public boolean isContainer()
public boolean isActiveObject()
public boolean isPassiveObject()
public boolean hasAncestor(java.lang.String tnName)
tnName
- the searched-for ancestor
public int createStructure(java.util.Vector containmentData, int myIx, ITreeNodeFactory factory, IInheritanceHierarchy inherHier)
containmentData
- Vector of containment data (composite structure) read in from a file.myIx
- Current index into the containment data vector.factory
- Where Xholon instances are made.inherHier
- Inheritance hierarchy tree containing instances of IXholonClass.
public void setPorts()
public IXholon getPort(int portNum)
portNum
- The index of the port within this Xholon's port array.
public boolean isBound(IXholon port)
If the port is intended to be a direct reference to another IXholon, then isBound() will return true if the port actually references a concrete IXholon, and will return false if the port value is null.
If the port is intended to be an IPort, then isBound() will return true if there is an end-to-end connection to a remote IXholon, and will return false if the port value is null or if it does not connect all the way through to a remote IXholon.
public void setRoleName(java.lang.String roleName)
roleName
- An optional name that identifies the role.public java.lang.String getRoleName()
public void setUid(java.lang.String uid)
uid
- A globally unique ID, typically assigned by some external tool such as a UML modeling tool.public java.lang.String getUid()
public double getVal()
public void setVal(double val)
val
- The new value.public void incVal(double incAmount)
incAmount
- Increment amount.public void incVal(int incAmount)
incAmount
- Increment amount.public void decVal(double decAmount)
decAmount
- Decrement amount.public void decVal(int decAmount)
decAmount
- Decrement amount.public boolean getVal_boolean()
public void setVal(boolean val)
public byte getVal_byte()
public void setVal(byte val)
public char getVal_char()
public void setVal(char val)
public double getVal_double()
public float getVal_float()
public void setVal(float val)
public int getVal_int()
public void setVal(int val)
public long getVal_long()
public void setVal(long val)
public short getVal_short()
public void setVal(short val)
public java.lang.String getVal_String()
public void setVal(java.lang.String val)
public java.lang.Object getVal_Object()
public void setVal(java.lang.Object val)
public int setVariableValue(java.lang.String instructions, int instructIx)
instructions
- A string containing the variable.instructIx
- An index into the string.
public java.lang.String handleNodeSelection()
public IXholon appendChild(java.lang.String xhClassName, java.lang.String roleName)
xhClassName
- Name of an existing IXholonClass.roleName
- Optional role name.
public IXholon appendChild(java.lang.String xhClassName, java.lang.String roleName, java.lang.String implName)
xhClassName
- Name of an existing IXholonClass.roleName
- Optional role name.implName
- Full-package name of a Java class.
public void sendMessage(int signal, java.lang.Object data, IXholon sender)
signal
- A distinguishing identifier for this message.data
- Any data that needs to be sent (optional).sender
- The sender of the message.public void sendMessage(int signal, java.lang.Object data, IXholon sender, int index)
signal
- A distinguishing identifier for this message.data
- Any data that needs to be sent (optional).sender
- The sender of the message.index
- The index of a replicated port.public void sendMessage(Message msg)
msg
- An already existing message.public void processReceivedMessage(Message msg)
msg
- The message that was received.public void processMessageQ()
public void terminate()
public void performActivity(int activityId, IMessage msg)
activityId
- An ID that uniquely identifies an activity to invoke.msg
- The message that triggered this Transition.public boolean performBooleanActivity(int activityId)
activityId
- An ID that uniquely identifies an activity to invoke.
public boolean performGuard(int activityId, IMessage msg)
activityId
- An ID that uniquely identifies an activity to invoke.
public void performActivity(int activityId)
activityId
- An ID that uniquely identifies an activity to invoke.public void performVoidActivity(IXholon activity)
activity
- IXholon representation of the activity.public double performDoubleActivity(IXholon activity)
activity
- IXholon representation of the activity.
public boolean performBooleanActivity(IXholon activity)
activity
- IXholon representation of the activity.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |