public abstract class Xholon extends java.lang.Object implements IXholon, java.lang.Comparable, java.io.Serializable
IXholon
,
Xholon Project website,
Serialized FormDEFAULT_SIZE_MSG_Q, DEFAULT_SIZE_SYSTEM_MSG_Q, GETNAME_DEFAULT, GETNAME_LOCALPART_ID, GETNAME_NOROLENAME, GETNAME_ROLENAME_OR_CLASSNAME, GETNAME_ROLENAMESEP_, GETNAME_SIZE_TEMPLATE, NINCLUDE_PSC, NINCLUDE_PSx, NINCLUDE_PxC, NINCLUDE_Pxx, NINCLUDE_xSC, NINCLUDE_xSx, NINCLUDE_xxC, NINCLUDE_xxx, XHOLON_ID_DEFAULT, XHOLON_ID_NULL
Constructor and Description |
---|
Xholon()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
act()
Do some action during this time step.
|
void |
actNr()
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.
|
boolean |
appendsOwnChildren()
Are instances of this class responsible for appending their own children?
This is useful for container classes that need to control the type of nodes
that they contain.
|
void |
bindPorts()
Bind port names to referenced nodes.
|
void |
cleanup()
Do any required cleanup work once the application has stopped executing.
|
int |
compareTo(java.lang.Object o) |
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.
|
void |
consoleLog(java.lang.Object obj) |
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 |
doAction(java.lang.String action)
Do a specific action that this xholon knows how to do.
|
boolean |
equals(java.lang.Object obj)
Two xholons are equal only if they are the same object.
|
IXholon |
findFirstChildWithXhClass(int childXhClassId)
Find the first child that matches the specified XholonClass id.
|
IXholon |
findFirstChildWithXhClass(java.lang.String childXhClassName)
Find the first child that matches the specified XholonClass name.
|
void |
forwardMessage(IMessage msg)
Forward a message to a registered forwardee, if any.
|
IMessage |
forwardSyncMessage(IMessage msg)
Forward a message to a registered forwardee, if any.
|
java.lang.String[] |
getActionList()
Get a list of actions that this xholon can do.
|
java.util.List |
getAllPorts()
Get a list of all ports exiting from this xholon.
|
java.lang.String |
getAnnotation()
Get the contents of the annotation for this Xholon.
|
IApplication |
getApp()
Get the instance of Application that owns this Xholon instance and the model of which it is a part.
|
IAttribute |
getAttributeNodeXh(java.lang.String name) |
java.lang.Object |
getAttributeXh(java.lang.String name) |
java.util.Vector |
getChildNodes(boolean deep)
Get all children of this node.
|
IXholonClass |
getClassNode(int id)
Get an instance of XholonClass, given its numeric id.
|
IXholonClass |
getClassNode(java.lang.String cName)
Get an instance of XholonClass, given its name.
|
ITreeNodeFactory |
getFactory()
Get the factory that creates IXholon instances.
|
IXholon |
getFirstChild()
Get first (leftmost) child of this node.
|
IXholon |
getFirstSibling()
Get first (leftmost) sibling.
|
int |
getId()
Get ID of this TreeNode instance.
|
IInteraction |
getInteraction()
Get the object that handles the capture and subsequent display of interactions.
|
boolean |
getInteractionsEnabled()
Get whether or not capture of interactions is enabled.
|
java.lang.String |
getIQueueImplName()
Get the name of the Java class that implements the IQueue interface.
|
IXholon |
getLastChild()
Get last (rightmost) child.
|
IXholon |
getLastSibling()
Get last (rightmost) sibling.
|
static Log |
getLogger()
Get the singleton instance of org.apache.commons.logging.Log.
|
IQueue |
getMsgQ()
Get the message Q.
|
java.lang.String |
getName()
Get name, unique within this application, of this Xholon instance.
|
java.lang.String |
getName(java.lang.String template)
Get the name of this Xholon instance, formatted according to a template.
|
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 doFullSubtree)
Get number of children that this node has.
|
int |
getNumLevels()
Get the number of levels in the tree starting from the current node.
|
int |
getNumSiblings()
Get number of siblings.
|
IXholon |
getParentNode()
Get parent of this node.
|
IXholon[] |
getPort()
Get the contents of the default port array, typically the port attribute in XholonWithPorts.
|
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 or subtree that this node is a part of.
|
java.util.Vector |
getSelfAndSiblings(boolean includeSameClassOnly)
Get self and siblings.
|
int |
getSelfAndSiblingsIndex(boolean includeSameClassOnly)
Get the position of this node among its siblings, as an index.
|
IXholon |
getService(java.lang.String serviceName)
Get a named service.
|
java.util.Vector |
getSiblings()
Get siblings.
|
IQueue |
getSystemMsgQ()
Get the system message Q.
|
java.lang.String |
getUid()
Get globally unique ID.
|
java.lang.String |
getUri()
Get the Uniform Resource Identifier (URI) that identifies this Xholon node.
|
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.
|
IXholon2Xml |
getXholon2Xml()
Get a new instance of Xholon2Xml.
|
int |
getXhType()
Get the Xholon type, as known to this Xholon's IXholonClass.
|
IXml2Xholon |
getXml2Xholon()
Get a configured instance of Xml2Xholon.
|
IXPath |
getXPath()
Get the singleton instance of XPath.
|
java.lang.Object |
handleNodeSelection()
Handle selection of a tree node by a user,
as when a person clicks on a JTree node in the default viewer.
|
java.lang.Object |
handleNodeSelection(IXholon otherNode)
Handle selection of some other node, such as the selection of a child node.
|
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 |
hasAnnotation()
Does this Xholon node have an annotation?
|
boolean |
hasAttributeXh(java.lang.String name) |
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.
|
boolean |
hasSiblingNodes()
Does this node have at least one sibling node, either a next sibling or a previous sibling?
|
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 newLeftSibling)
Insert this node after its new previous sibling node.
|
IXholon |
insertAfter(java.lang.String xhClassName,
java.lang.String roleName)
Create a new child, and insert it after this node.
|
IXholon |
insertAfter(java.lang.String xhClassName,
java.lang.String roleName,
java.lang.String implName)
Create a new child, and insert it after this node.
|
void |
insertBefore(IXholon newNextSibling)
Insert this node before its new next sibling node.
|
IXholon |
insertBefore(java.lang.String xhClassName,
java.lang.String roleName)
Create a new child, and insert it before this node.
|
IXholon |
insertBefore(java.lang.String xhClassName,
java.lang.String roleName,
java.lang.String implName)
Create a new child, and insert it before this 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 |
isAttributeHandler()
Does this IXholon node handle its own Attribute children?
Typically, a IXholon node should return false,
which will tell the framework to handle Attribute children in the default way.
|
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()
This node is the root node of the tree or subtree, if either:
|
boolean |
isUniqueSibling()
Is this node unique among its siblings?
It is unique if no sibling has the same XholonClass,
or if the node has no siblings.
|
boolean |
isUniqueSiblingRoleName()
Is this node unique among its siblings?
It is unique if no sibling has the same XholonClass and the same roleName,
or if the node has no siblings.
|
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 System.out or to a PrintWriter.
|
void |
println(java.lang.Object obj)
Write an object to System.out or to a PrintWriter, terminated with an end-of-line.
|
void |
processMessageQ()
Process messages that are on the application message queue.
|
void |
processReceivedMessage(IMessage msg)
Process a received message taken from the message queue.
|
IMessage |
processReceivedSyncMessage(IMessage msg)
Process a received Synchronous message.
|
void |
processSystemMessageQ()
Process messages that are on the system message queue.
|
void |
reconfigure()
Reconfigure, such as at the start of a new GP generation.
|
void |
registerMessageForwardee(IXholon forwardee,
int[] signal)
Register a message forwardee.
|
void |
remove()
Remove this node from the model, by recursively removing all children and next siblings,
and by then returning it to the factory.
|
IAttribute |
removeAttributeNodeXh(IAttribute oldAttr) |
void |
removeAttributeXh(java.lang.String name) |
void |
removeChild()
Detach this node from its parent and from any siblings.
|
void |
replaceNode(IXholon replacementNode)
Replace a node in the tree with a replacement node.
|
java.util.List<IXholon> |
searchForReferencingNodes()
Search for instances of Xholon with ports that reference this instance.
|
void |
searchForReferencingNodesRecurse(Xholon reffedNode,
java.util.List<IXholon> reffingNodes)
Search for instances of Xholon with ports that reference this instance.
|
void |
sendMessage(IMessage msg)
Send a message to a receiving Xholon instance.
|
void |
sendMessage(int signal,
java.lang.Object data,
IXholon sender)
Send a message to a receiving Xholon instance.
|
void |
sendMessage(int signal,
java.lang.Object data,
IXholon sender,
int index)
Send a message to a receiving Xholon instance.
|
IMessage |
sendSyncMessage(IMessage msg)
Send a Synchronous message to a receiving Xholon instance.
|
IMessage |
sendSyncMessage(int signal,
java.lang.Object data,
IXholon sender)
Send a Synchronous message to a receiving Xholon instance.
|
IMessage |
sendSyncMessage(int signal,
java.lang.Object data,
IXholon sender,
int index)
Send a Synchronous message to a receiving Xholon instance.
|
void |
sendSystemMessage(IMessage msg)
Send a system message to a receiving Xholon instance.
|
void |
sendSystemMessage(int signal,
java.lang.Object data,
IXholon sender)
Send a system message to a receiving Xholon instance.
|
void |
setActionList(java.lang.String[] actionList)
Set the list of actions that this xholon can do.
|
void |
setAnnotation(java.lang.String annotation)
Set the contents of an annotation for this Xholon.
|
void |
setApp(IApplication app)
Set the instance of Application that owns this Xholon instance and the model of which it is a part.
|
void |
setAttributeNodeXh(IAttribute newAttr) |
int |
setAttributeVal(java.lang.String attrName,
java.lang.String attrVal)
Set the value of an attribute, given it's name.
|
void |
setAttributeXh(java.lang.String name,
java.lang.Object value) |
void |
setFirstChild(IXholon treeNode)
Set first (leftmost) child of this node.
|
void |
setId(int entityId)
Set the ID of this TreeNode instance.
|
void |
setName(java.lang.String name)
Hibernate requires a setter and getter for each property that it persists.
|
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 |
setPort(int portNum,
IXholon portRef)
Set the IXholon that this port references.
|
void |
setPort(IXholon[] port)
Set the contents of the default port array, typically the port attribute in XholonWithPorts.
|
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 |
setUri(java.lang.String uri)
Set the Uniform Resource Identifier (URI) that identifies this Xholon node.
|
void |
setVal_boolean(boolean val)
Set the value of a "boolean" maintained by this xholon instance.
|
void |
setVal_byte(byte val)
Set the value of a "byte" maintained by this xholon instance.
|
void |
setVal_char(char val)
Set the value of a "char" maintained by this xholon instance.
|
void |
setVal_double(double val)
Set the value of a "double" maintained by this xholon instance.
|
void |
setVal_float(float val)
Set the value of a "float" maintained by this xholon instance.
|
void |
setVal_int(int val)
Set the value of a "int" maintained by this xholon instance.
|
void |
setVal_long(long val)
Set the value of a "long" maintained by this xholon instance.
|
void |
setVal_Object(java.lang.Object val)
Set the value of a "Object" maintained by this xholon instance.
|
void |
setVal_short(short val)
Set the value of a "short" maintained by this xholon instance.
|
void |
setVal_String(java.lang.String val)
Set the value of a "String" maintained by this xholon instance.
|
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.
|
void |
setXhc(IXholonClass xhcNode)
Set the IXholonClass to which this Xholon instance belongs.
|
void |
showAnnotation()
Show the annotation in some appropriate way.
|
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.
|
java.lang.String |
toString() |
void |
toXml(IXholon2Xml xholon2xml,
IXmlWriter xmlWriter)
Write self as XML.
|
void |
toXmlAttribute(IXholon2Xml xholon2xml,
IXmlWriter xmlWriter,
java.lang.String name,
java.lang.String value,
java.lang.Class clazz)
Write one attribute formatted as XML.
|
void |
toXmlAttributes(IXholon2Xml xholon2xml,
IXmlWriter xmlWriter)
Write a set of attributes formatted as XML.
|
void |
toXmlText(IXholon2Xml xholon2xml,
IXmlWriter xmlWriter)
Write text formatted as XML.
|
int |
treeSize()
Get number of nodes in tree.
|
boolean |
visit(IXholon visitor)
Visit another IXholon, and perform some operation.
|
public void remove()
IXholon
public ITreeNodeFactory getFactory()
public java.lang.String getIQueueImplName()
public IQueue getMsgQ()
public IQueue getSystemMsgQ()
public boolean getInteractionsEnabled()
public IInteraction getInteraction()
public IApplication getApp()
IXholon
public void setApp(IApplication app)
IXholon
public final IXPath getXPath()
public static final Log getLogger()
public IXholon getParentNode()
IXholon
getParentNode
in interface IXholon
public IXholon getFirstChild()
IXholon
getFirstChild
in interface IXholon
public IXholon getNextSibling()
IXholon
getNextSibling
in interface IXholon
public IXholon getPreviousSibling()
IXholon
getPreviousSibling
in interface IXholon
public void setParentNode(IXholon treeNode)
IXholon
setParentNode
in interface IXholon
treeNode
- This node's new parent.public void setFirstChild(IXholon treeNode)
IXholon
setFirstChild
in interface IXholon
treeNode
- This node's new first child.public void setNextSibling(IXholon treeNode)
IXholon
setNextSibling
in interface IXholon
treeNode
- This node's new next sibling.public IXholon getRootNode()
IXholon
getRootNode
in interface IXholon
public IXholon findFirstChildWithXhClass(int childXhClassId)
IXholon
findFirstChildWithXhClass
in interface IXholon
public IXholon findFirstChildWithXhClass(java.lang.String childXhClassName)
IXholon
findFirstChildWithXhClass
in interface IXholon
public void setParentChildLinks(IXholon parent)
IXholon
setParentChildLinks
in interface IXholon
parent
- This node's new parent.public void setParentSiblingLinks(IXholon previousSibling)
IXholon
setParentSiblingLinks
in interface IXholon
previousSibling
- This node's new previous sibling.public void removeChild()
IXholon
removeChild
in interface IXholon
public void insertAfter(IXholon newLeftSibling)
IXholon
insertAfter
in interface IXholon
newLeftSibling
- New previous sibling of this node.public IXholon insertAfter(java.lang.String xhClassName, java.lang.String roleName)
IXholon
insertAfter
in interface IXholon
xhClassName
- Name of an existing IXholonClass.roleName
- Optional role name.public IXholon insertAfter(java.lang.String xhClassName, java.lang.String roleName, java.lang.String implName)
IXholon
insertAfter
in interface IXholon
xhClassName
- Name of an existing IXholonClass.roleName
- Optional role name.implName
- Full-package name of a Java class.public void insertBefore(IXholon newNextSibling)
IXholon
insertBefore
in interface IXholon
newNextSibling
- New next sibling of this node.public IXholon insertBefore(java.lang.String xhClassName, java.lang.String roleName)
IXholon
insertBefore
in interface IXholon
xhClassName
- Name of an existing IXholonClass.roleName
- Optional role name.public IXholon insertBefore(java.lang.String xhClassName, java.lang.String roleName, java.lang.String implName)
IXholon
insertBefore
in interface IXholon
xhClassName
- Name of an existing IXholonClass.roleName
- Optional role name.implName
- Full-package name of a Java class.public void insertFirstChild(IXholon newParentNode)
IXholon
insertFirstChild
in interface IXholon
newParentNode
- New parent of this node.public void appendChild(IXholon newParentNode)
IXholon
appendChild
in interface IXholon
newParentNode
- New parent of this node.public IXholon appendChild(java.lang.String xhClassName, java.lang.String roleName)
IXholon
appendChild
in interface IXholon
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)
IXholon
appendChild
in interface IXholon
xhClassName
- Name of an existing IXholonClass.roleName
- Optional role name.implName
- Full-package name of a Java class.public boolean appendsOwnChildren()
IXholon
appendsOwnChildren
in interface IXholon
public void replaceNode(IXholon replacementNode)
IXholon
replaceNode
in interface IXholon
replacementNode
- A free-floating node, one that is not currently in the Xholon tree.
It will replace the current node at the same location in the tree.public void swapNode(IXholon otherNode)
IXholon
public int depth()
IXholon
public int height()
IXholon
public int getNumLevels()
IXholon
getNumLevels
in interface IXholon
public int treeSize()
IXholon
public boolean isRootNode()
(1) its parent is null, or
(2) its parent's XhcId == CeControl.ControlCE .
TODO but children of View node should not be root nodesisRootNode
in interface IXholon
IXholon.isRootNode()
public boolean isExternal()
IXholon
isExternal
in interface IXholon
public boolean isInternal()
IXholon
isInternal
in interface IXholon
public boolean isLeaf()
IXholon
public boolean isAttributeHandler()
IXholon
isAttributeHandler
in interface IXholon
public java.util.Vector getChildNodes(boolean deep)
IXholon
getChildNodes
in interface IXholon
deep
- If true then return entire nested subtree, if false return only immediate children.public IXholon getNthChild(int n, boolean deep)
IXholon
getNthChild
in interface IXholon
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()
IXholon
hasParentNode
in interface IXholon
public boolean hasChildNodes()
IXholon
hasChildNodes
in interface IXholon
public boolean hasNextSibling()
IXholon
hasNextSibling
in interface IXholon
public boolean hasChildOrSiblingNodes()
IXholon
hasChildOrSiblingNodes
in interface IXholon
public boolean hasSiblingNodes()
IXholon
hasSiblingNodes
in interface IXholon
public int getNumChildren(boolean doFullSubtree)
IXholon
getNumChildren
in interface IXholon
doFullSubtree
- If true then return entire nested subtree, if false return only immediate children.public IXholon getLastChild()
IXholon
getLastChild
in interface IXholon
public IXholon getLastSibling()
IXholon
getLastSibling
in interface IXholon
public IXholon getFirstSibling()
IXholon
getFirstSibling
in interface IXholon
public java.util.Vector getSelfAndSiblings(boolean includeSameClassOnly)
IXholon
getSelfAndSiblings
in interface IXholon
includeSameClassOnly
- Whether or not to only return nodes that are the same XholonClass as this node.public java.util.Vector getSiblings()
IXholon
getSiblings
in interface IXholon
public IXholon getNthSibling(int n)
IXholon
getNthSibling
in interface IXholon
n
- The index of the sibling being requested.public int getNumSiblings()
IXholon
getNumSiblings
in interface IXholon
public int getSelfAndSiblingsIndex(boolean includeSameClassOnly)
IXholon
getSelfAndSiblingsIndex
in interface IXholon
includeSameClassOnly
- Whether or not to only include nodes that are the same XholonClass as this node.public boolean isUniqueSibling()
IXholon
Is this node unique among its siblings? It is unique if no sibling has the same XholonClass, or if the node has no siblings. Otherwise it is not unique.
isUniqueSibling
in interface IXholon
public boolean isUniqueSiblingRoleName()
IXholon
Is this node unique among its siblings? It is unique if no sibling has the same XholonClass and the same roleName, or if the node has no siblings. Otherwise it is not unique.
TODO If the roleName is null or the empty String, then it is considered not unique.
isUniqueSiblingRoleName
in interface IXholon
public java.util.Vector getNeighbors(int distance, int include, java.lang.String excludeBecName)
IXholon
getNeighbors
in interface IXholon
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 methodpublic void initStatics()
IXholon
initStatics
in interface IXholon
public void preConfigure()
IXholon
preConfigure
in interface IXholon
public int configure(java.lang.String instructions, int instructIx)
IXholon
public void print(java.lang.Object obj)
IXholon
public void println(java.lang.Object obj)
IXholon
public void initialize()
IXholon
initialize
in interface IXholon
public int getId()
IXholon
public java.lang.String getName()
IXholon
public java.lang.String getName(java.lang.String template)
IXholon
getName
in interface IXholon
template
- A fixed length template that specifies what elements are included as part of the name.
ex: "r:c_i^" is roleName + ":" + className with first letter lowercase + "_" + id
The template fields are in fixed positions, and may have the following values:
(1) r include roleName, ^ don't include role name
(2) : ^
(3) c className lowercase, C classname lowercase, l local part, L local part
(4) _ ^
(5) i include id
(6) ^
If an invalid template is input, then the returned name will be in the default format, as defined by the GETNAME_DEFAULT constant. The default format is exactly the same as what would be returned by calling getName() without specifying a template.
public void setId(int entityId)
IXholon
public void setName(java.lang.String name)
IXholon
public double getVal()
IXholon
public void setVal(double val)
IXholon
public void setVal_double(double val)
IXholon
setVal_double
in interface IXholon
public void incVal(double incAmount)
IXholon
public void incVal(int incAmount)
IXholon
public void decVal(double decAmount)
IXholon
public void decVal(int decAmount)
IXholon
public boolean getVal_boolean()
IXholon
getVal_boolean
in interface IXholon
public byte getVal_byte()
IXholon
getVal_byte
in interface IXholon
public char getVal_char()
IXholon
getVal_char
in interface IXholon
public double getVal_double()
IXholon
getVal_double
in interface IXholon
public float getVal_float()
IXholon
getVal_float
in interface IXholon
public int getVal_int()
IXholon
getVal_int
in interface IXholon
public long getVal_long()
IXholon
getVal_long
in interface IXholon
public java.lang.Object getVal_Object()
IXholon
getVal_Object
in interface IXholon
public short getVal_short()
IXholon
getVal_short
in interface IXholon
public java.lang.String getVal_String()
IXholon
getVal_String
in interface IXholon
public void setVal(boolean val)
IXholon
public void setVal_boolean(boolean val)
IXholon
setVal_boolean
in interface IXholon
public void setVal(byte val)
IXholon
public void setVal_byte(byte val)
IXholon
setVal_byte
in interface IXholon
public void setVal(char val)
IXholon
public void setVal_char(char val)
IXholon
setVal_char
in interface IXholon
public void setVal(float val)
IXholon
public void setVal_float(float val)
IXholon
setVal_float
in interface IXholon
public void setVal(int val)
IXholon
public void setVal_int(int val)
IXholon
setVal_int
in interface IXholon
public void setVal(long val)
IXholon
public void setVal_long(long val)
IXholon
setVal_long
in interface IXholon
public void setVal(java.lang.Object val)
IXholon
public void setVal_Object(java.lang.Object val)
IXholon
setVal_Object
in interface IXholon
public void setVal(short val)
IXholon
public void setVal_short(short val)
IXholon
setVal_short
in interface IXholon
public void setVal(java.lang.String val)
IXholon
public void setVal_String(java.lang.String val)
IXholon
setVal_String
in interface IXholon
public int setAttributeVal(java.lang.String attrName, java.lang.String attrVal)
IXholon
setAttributeVal
in interface IXholon
attrName
- The name of an attribute.attrVal
- The intended value of the attribute.public IXholonClass getClassNode(java.lang.String cName)
IXholon
getClassNode
in interface IXholon
cName
- Name of the XholonClass (ex: "HelloWorld").public IXholonClass getClassNode(int id)
IXholon
getClassNode
in interface IXholon
public IXholonClass getXhc()
IXholon
public int getXhcId()
IXholon
public java.lang.String getXhcName()
IXholon
getXhcName
in interface IXholon
public void setXhc(IXholonClass xhcNode)
IXholon
public int getXhType()
IXholon
public boolean isContainer()
IXholon
isContainer
in interface IXholon
public boolean isActiveObject()
IXholon
isActiveObject
in interface IXholon
public boolean isPassiveObject()
IXholon
isPassiveObject
in interface IXholon
public boolean hasAncestor(java.lang.String tnName)
IXholon
hasAncestor
in interface IXholon
tnName
- the searched-for ancestorpublic void setPorts()
IXholon
public void bindPorts()
public void consoleLog(java.lang.Object obj)
consoleLog
in interface IXholon
public void configure()
IXholon
public void postConfigure()
IXholon
postConfigure
in interface IXholon
public void preReconfigure()
IXholon
preReconfigure
in interface IXholon
public void reconfigure()
IXholon
reconfigure
in interface IXholon
public void postReconfigure()
IXholon
postReconfigure
in interface IXholon
public void preAct()
IXholon
public void act()
IXholon
public void actNr()
IXholon
public void postAct()
IXholon
public void cleanup()
IXholon
public void preOrderPrint(int level)
IXholon
preOrderPrint
in interface IXholon
level
- Level in the tree, where the root node is level 0.public void inOrderPrint(int level)
IXholon
inOrderPrint
in interface IXholon
level
- Level in the tree, where the root node is level 0.public void postOrderPrint(int level)
IXholon
postOrderPrint
in interface IXholon
level
- Level in the tree, where the root node is level 0.public boolean visit(IXholon visitor)
IXholon
If a visitor and visitee object are the same, then the default implementation of the visit method will not call its visitor.
visit
in interface IXholon
visitor
- A visitor.IXholon.visit(org.primordion.xholon.base.IXholon)
public java.lang.Object handleNodeSelection()
IXholon
handleNodeSelection
in interface IXholon
public java.lang.Object handleNodeSelection(IXholon otherNode)
IXholon
handleNodeSelection
in interface IXholon
otherNode
- The actual node selected, such as a child node.public void sendMessage(int signal, java.lang.Object data, IXholon sender)
IXholon
sendMessage
in interface IXholon
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)
IXholon
sendMessage
in interface IXholon
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(IMessage msg)
IXholon
sendMessage
in interface IXholon
msg
- An already existing message.public void processReceivedMessage(IMessage msg)
IXholon
processReceivedMessage
in interface IXholon
msg
- The message that was received.public void registerMessageForwardee(IXholon forwardee, int[] signal)
IXholon
registerMessageForwardee
in interface IXholon
forwardee
- A node that wants to receive otherwise unhandled messages.signal
- An array of one or more signals that the forwardee is able to handle,
or null if it's able to handle any message. An empty array is ignored.public void forwardMessage(IMessage msg)
IXholon
forwardMessage
in interface IXholon
msg
- The message that should be forwarded.public void processMessageQ()
IXholon
processMessageQ
in interface IXholon
public void sendSystemMessage(int signal, java.lang.Object data, IXholon sender)
IXholon
sendSystemMessage
in interface IXholon
signal
- A distinguishing identifier for this message.data
- Any data that needs to be sent (optional).sender
- The sender of the message.public void sendSystemMessage(IMessage msg)
IXholon
sendSystemMessage
in interface IXholon
msg
- An already existing message.public void processSystemMessageQ()
IXholon
processSystemMessageQ
in interface IXholon
public IMessage sendSyncMessage(int signal, java.lang.Object data, IXholon sender)
IXholon
sendSyncMessage
in interface IXholon
signal
- A distinguishing identifier for this message.data
- Any data that needs to be sent (optional).sender
- The sender of the message.public IMessage sendSyncMessage(int signal, java.lang.Object data, IXholon sender, int index)
IXholon
sendSyncMessage
in interface IXholon
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 IMessage sendSyncMessage(IMessage msg)
IXholon
sendSyncMessage
in interface IXholon
msg
- An already existing message.public IMessage processReceivedSyncMessage(IMessage msg)
IXholon
processReceivedSyncMessage
in interface IXholon
msg
- The message that was received.public IMessage forwardSyncMessage(IMessage msg)
IXholon
forwardSyncMessage
in interface IXholon
msg
- The message that should be forwarded.public void terminate()
IXholon
public java.util.List<IXholon> searchForReferencingNodes()
IXholon
searchForReferencingNodes
in interface IXholon
public void searchForReferencingNodesRecurse(Xholon reffedNode, java.util.List<IXholon> reffingNodes)
reffedNode
- The Xholon node that we're looking for references to.reffingNodes
- A list that is being filled with references.public void performActivity(int activityId, IMessage msg)
IXholon
performActivity
in interface IXholon
activityId
- An ID that uniquely identifies an activity to invoke.msg
- The message that triggered this Transition.public boolean performBooleanActivity(int activityId)
IXholon
performBooleanActivity
in interface IXholon
activityId
- An ID that uniquely identifies an activity to invoke.public boolean performGuard(int activityId, IMessage msg)
IXholon
performGuard
in interface IXholon
activityId
- An ID that uniquely identifies an activity to invoke.public void performActivity(int activityId)
IXholon
performActivity
in interface IXholon
activityId
- An ID that uniquely identifies an activity to invoke.public void performVoidActivity(IXholon activity)
IXholon
performVoidActivity
in interface IXholon
activity
- IXholon representation of the activity.public double performDoubleActivity(IXholon activity)
IXholon
performDoubleActivity
in interface IXholon
activity
- IXholon representation of the activity.public boolean performBooleanActivity(IXholon activity)
IXholon
performBooleanActivity
in interface IXholon
activity
- IXholon representation of the activity.public void setPort(IXholon[] port)
IXholon
public IXholon[] getPort()
IXholon
public void setPort(int portNum, IXholon portRef)
IXholon
public IXholon getPort(int portNum)
IXholon
public java.util.List getAllPorts()
IXholon
getAllPorts
in interface IXholon
public boolean isBound(IXholon port)
IXholon
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 IXholon getService(java.lang.String serviceName)
IXholon
getService
in interface IXholon
serviceName
- The name of a service.
This is the name used in XholonService.xml, which is the IXholonClass name.public void setRoleName(java.lang.String roleName)
IXholon
setRoleName
in interface IXholon
roleName
- An optional name that identifies the role.public java.lang.String getRoleName()
IXholon
getRoleName
in interface IXholon
public void setUid(java.lang.String uid)
IXholon
public java.lang.String getUid()
IXholon
public void setUri(java.lang.String uri)
IXholon
public java.lang.String getUri()
IXholon
public void setAnnotation(java.lang.String annotation)
IXholon
setAnnotation
in interface IXholon
annotation
- Some text.public java.lang.String getAnnotation()
IXholon
getAnnotation
in interface IXholon
public boolean hasAnnotation()
IXholon
hasAnnotation
in interface IXholon
public void showAnnotation()
IXholon
showAnnotation
in interface IXholon
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
public java.lang.String[] getActionList()
IXholon
getActionList
in interface IXholon
public void setActionList(java.lang.String[] actionList)
IXholon
setActionList
in interface IXholon
actionList
- A list of actions, or null.public void doAction(java.lang.String action)
IXholon
public IXml2Xholon getXml2Xholon()
getXml2Xholon
in interface IXholon
public IXholon2Xml getXholon2Xml()
getXholon2Xml
in interface IXholon
public void toXml(IXholon2Xml xholon2xml, IXmlWriter xmlWriter)
IXholon
public void toXmlAttributes(IXholon2Xml xholon2xml, IXmlWriter xmlWriter)
IXholon
toXmlAttributes
in interface IXholon
xmlWriter
- The XML writer.public void toXmlAttribute(IXholon2Xml xholon2xml, IXmlWriter xmlWriter, java.lang.String name, java.lang.String value, java.lang.Class clazz)
IXholon
toXmlAttribute
in interface IXholon
xmlWriter
- The XML writer.name
- Name of the attribute.value
- Value of the attribute.public void toXmlText(IXholon2Xml xholon2xml, IXmlWriter xmlWriter)
IXholon
public java.lang.Object getAttributeXh(java.lang.String name)
getAttributeXh
in interface IXholon
public void setAttributeXh(java.lang.String name, java.lang.Object value)
setAttributeXh
in interface IXholon
public void removeAttributeXh(java.lang.String name)
removeAttributeXh
in interface IXholon
public boolean hasAttributeXh(java.lang.String name)
hasAttributeXh
in interface IXholon
public IAttribute getAttributeNodeXh(java.lang.String name)
getAttributeNodeXh
in interface IXholon
public void setAttributeNodeXh(IAttribute newAttr)
setAttributeNodeXh
in interface IXholon
public IAttribute removeAttributeNodeXh(IAttribute oldAttr)
removeAttributeNodeXh
in interface IXholon
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public java.lang.String toString()
toString
in class java.lang.Object