org.primordion.xholon.samples
Class XhWatch

java.lang.Object
  extended byorg.primordion.xholon.base.Xholon
      extended byorg.primordion.xholon.base.XholonWithPorts
          extended byorg.primordion.xholon.samples.XhWatch
All Implemented Interfaces:
IXholon

public class XhWatch
extends XholonWithPorts

Digital Watch. This is the detailed behavior of a sample Xholon application.

Since:
0.1 (Created on September 25, 2005) In most cases a button needs to be pressed and subsequently released for an event to occur. ex: s1 and s2 events in Update state In some cases one event is caused by pressing a button, and another by releasing it. ex: s1 and s2 in BeepTestControl

Author:
Ken Webb

Field Summary
static int BEEP_CONTINUOUSLY
           
static int BEEP_ONCE
           
static int BUTTON_S1_HELD
           
static int BUTTON_S1_PRESSED
           
static int BUTTON_S1_RELEASED
           
static int BUTTON_S2_HELD
           
static int BUTTON_S2_PRESSED
           
static int BUTTON_S2_RELEASED
           
static int BUTTON_S3_HELD
           
static int BUTTON_S3_PRESSED
           
static int BUTTON_S3_RELEASED
           
static int BUTTON_S4_HELD
           
static int BUTTON_S4_PRESSED
           
static int BUTTON_S4_RELEASED
           
static int DISPLAY_ALARM_STATUS
           
static int DISPLAY_CHIME_STATUS
           
static int DISPLAY_DATE
           
static int DISPLAY_DAYOFWEEK
           
static int DISPLAY_MODE
           
static int DISPLAY_TIME
           
static int INCREMENT_DATE
           
static int INCREMENT_DAY
           
static int INCREMENT_HOUR
           
static int INCREMENT_MIN
           
static int INCREMENT_MONTH
           
static int INCREMENT_SEC
           
static int LIGHT_OFF
           
static int LIGHT_ON
           
static int NOTS1
           
static int NOTS2
           
static int NOTS3
           
static int NOTS4
           
static int P_ALARMCHIME_CNTRL
           
static int P_BEEP_CMD
           
static int P_BUTTON_S1
           
static int P_BUTTON_S2
           
static int P_BUTTON_S3
           
static int P_BUTTON_S4
           
static int P_DISPLAY_CMD
           
static int P_GUIEVENT12
           
static int P_GUIEVENT123
           
static int P_GUIEVENT4
           
static int P_LIGHT_CMD
           
static int P_STOPWATCH_CNTRL
           
static int P_TIMEDATE_CNTRL
           
static int P_TIMER_TICK
           
 java.lang.String roleName
           
static int S1
           
static int S2
           
static int S3
           
static int S3FOR2SECONDS
           
static int S4
           
static int SHOW_DATE
           
static int SHOW_TIME
           
 int state
           
static int STOP_BEEPING
           
static int TICK
           
 
Fields inherited from class org.primordion.xholon.base.XholonWithPorts
port
 
Fields inherited from class org.primordion.xholon.base.Xholon
DEFAULT_LEVEL, interaction, interactionsEnabled
 
Fields inherited from interface org.primordion.xholon.base.IXholon
DEFAULT_SIZE_MSG_Q, NINCLUDE_PSC, NINCLUDE_PSx, NINCLUDE_PxC, NINCLUDE_Pxx, NINCLUDE_xSC, NINCLUDE_xSx, NINCLUDE_xxC, NINCLUDE_xxx
 
Constructor Summary
XhWatch()
          Constructor.
 
Method Summary
 void act()
          Do some action during this time step.
 java.lang.String getRoleName()
          Get name of the role played by this Xholon within a specific context.
 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.
 void initialize()
          Initialize the tree node.
 void performActivity(int activityId, IMessage msg)
          Do the UML2 Activity identified by the activityId.
 void processReceivedMessage(Message msg)
          Process a received ROOM/UML2 message taken from the message queue.
 void setRoleName(java.lang.String roleName)
          Set name of the role played by this Xholon within a specific context.
 java.lang.String toString()
           
 
Methods inherited from class org.primordion.xholon.base.XholonWithPorts
configure, getMaxPorts, getPort, isActiveObject, isBound, isContainer, isPassiveObject, postConfigure, setMaxPorts, setPorts, terminate
 
Methods inherited from class org.primordion.xholon.base.Xholon
appendChild, appendChild, appendChild, cleanup, configure, createStructure, decVal, decVal, depth, draw, getChildNodes, getFirstChild, getFirstSibling, getId, getLastChild, getLastSibling, getName, getNeighbors, getNextId, getNextSibling, getNthChild, getNthSibling, getNumChildren, getNumSiblings, getParentNode, getPreviousSibling, getRootNode, getSiblings, getSizeMessageQ, getUid, getVal_boolean, getVal_byte, getVal_char, getVal_double, getVal_float, getVal_int, getVal_long, getVal_Object, getVal_short, getVal_String, getVal, getXhc, getXhcId, getXhcName, getXhType, hasAncestor, hasChildNodes, hasChildOrSiblingNodes, hasNextSibling, hasParentNode, height, incVal, incVal, initStatics, inOrderPrint, insertAfter, insertBefore, insertFirstChild, isExternal, isInternal, isLeaf, isRootNode, performActivity, performBooleanActivity, performBooleanActivity, performDoubleActivity, performGuard, performVoidActivity, postAct, postOrderPrint, postReconfigure, preAct, preConfigure, preOrderPrint, preReconfigure, print, println, processMessageQ, reconfigure, remove, removeChild, resetNextId, sendMessage, sendMessage, sendMessage, setAttributeVal, setFactory, setFirstChild, setId, setNextSibling, setParentChildLinks, setParentNode, setParentSiblingLinks, setSizeMessageQ, setUid, setVal, setVal, setVal, setVal, setVal, setVal, setVal, setVal, setVal, setVal, setVariableValue, setXhc, swapNode, treeSize, writeXml
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

P_BUTTON_S1

public static final int P_BUTTON_S1
See Also:
Constant Field Values

P_BUTTON_S2

public static final int P_BUTTON_S2
See Also:
Constant Field Values

P_BUTTON_S3

public static final int P_BUTTON_S3
See Also:
Constant Field Values

P_BUTTON_S4

public static final int P_BUTTON_S4
See Also:
Constant Field Values

P_GUIEVENT123

public static final int P_GUIEVENT123
See Also:
Constant Field Values

P_GUIEVENT4

public static final int P_GUIEVENT4
See Also:
Constant Field Values

P_GUIEVENT12

public static final int P_GUIEVENT12
See Also:
Constant Field Values

P_TIMEDATE_CNTRL

public static final int P_TIMEDATE_CNTRL
See Also:
Constant Field Values

P_ALARMCHIME_CNTRL

public static final int P_ALARMCHIME_CNTRL
See Also:
Constant Field Values

P_STOPWATCH_CNTRL

public static final int P_STOPWATCH_CNTRL
See Also:
Constant Field Values

P_TIMER_TICK

public static final int P_TIMER_TICK
See Also:
Constant Field Values

P_DISPLAY_CMD

public static final int P_DISPLAY_CMD
See Also:
Constant Field Values

P_LIGHT_CMD

public static final int P_LIGHT_CMD
See Also:
Constant Field Values

P_BEEP_CMD

public static final int P_BEEP_CMD
See Also:
Constant Field Values

BUTTON_S1_PRESSED

public static final int BUTTON_S1_PRESSED
See Also:
Constant Field Values

BUTTON_S1_RELEASED

public static final int BUTTON_S1_RELEASED
See Also:
Constant Field Values

BUTTON_S1_HELD

public static final int BUTTON_S1_HELD
See Also:
Constant Field Values

BUTTON_S2_PRESSED

public static final int BUTTON_S2_PRESSED
See Also:
Constant Field Values

BUTTON_S2_RELEASED

public static final int BUTTON_S2_RELEASED
See Also:
Constant Field Values

BUTTON_S2_HELD

public static final int BUTTON_S2_HELD
See Also:
Constant Field Values

BUTTON_S3_PRESSED

public static final int BUTTON_S3_PRESSED
See Also:
Constant Field Values

BUTTON_S3_RELEASED

public static final int BUTTON_S3_RELEASED
See Also:
Constant Field Values

BUTTON_S3_HELD

public static final int BUTTON_S3_HELD
See Also:
Constant Field Values

BUTTON_S4_PRESSED

public static final int BUTTON_S4_PRESSED
See Also:
Constant Field Values

BUTTON_S4_RELEASED

public static final int BUTTON_S4_RELEASED
See Also:
Constant Field Values

BUTTON_S4_HELD

public static final int BUTTON_S4_HELD
See Also:
Constant Field Values

S1

public static final int S1
See Also:
Constant Field Values

S2

public static final int S2
See Also:
Constant Field Values

S3

public static final int S3
See Also:
Constant Field Values

S4

public static final int S4
See Also:
Constant Field Values

NOTS1

public static final int NOTS1
See Also:
Constant Field Values

NOTS2

public static final int NOTS2
See Also:
Constant Field Values

NOTS3

public static final int NOTS3
See Also:
Constant Field Values

NOTS4

public static final int NOTS4
See Also:
Constant Field Values

S3FOR2SECONDS

public static final int S3FOR2SECONDS
See Also:
Constant Field Values

INCREMENT_SEC

public static final int INCREMENT_SEC
See Also:
Constant Field Values

INCREMENT_MIN

public static final int INCREMENT_MIN
See Also:
Constant Field Values

INCREMENT_HOUR

public static final int INCREMENT_HOUR
See Also:
Constant Field Values

INCREMENT_MONTH

public static final int INCREMENT_MONTH
See Also:
Constant Field Values

INCREMENT_DAY

public static final int INCREMENT_DAY
See Also:
Constant Field Values

INCREMENT_DATE

public static final int INCREMENT_DATE
See Also:
Constant Field Values

SHOW_TIME

public static final int SHOW_TIME
See Also:
Constant Field Values

SHOW_DATE

public static final int SHOW_DATE
See Also:
Constant Field Values

TICK

public static final int TICK
See Also:
Constant Field Values

DISPLAY_TIME

public static final int DISPLAY_TIME
See Also:
Constant Field Values

DISPLAY_DATE

public static final int DISPLAY_DATE
See Also:
Constant Field Values

DISPLAY_ALARM_STATUS

public static final int DISPLAY_ALARM_STATUS
See Also:
Constant Field Values

DISPLAY_CHIME_STATUS

public static final int DISPLAY_CHIME_STATUS
See Also:
Constant Field Values

DISPLAY_DAYOFWEEK

public static final int DISPLAY_DAYOFWEEK
See Also:
Constant Field Values

DISPLAY_MODE

public static final int DISPLAY_MODE
See Also:
Constant Field Values

LIGHT_ON

public static final int LIGHT_ON
See Also:
Constant Field Values

LIGHT_OFF

public static final int LIGHT_OFF
See Also:
Constant Field Values

BEEP_CONTINUOUSLY

public static final int BEEP_CONTINUOUSLY
See Also:
Constant Field Values

BEEP_ONCE

public static final int BEEP_ONCE
See Also:
Constant Field Values

STOP_BEEPING

public static final int STOP_BEEPING
See Also:
Constant Field Values

state

public int state

roleName

public java.lang.String roleName
Constructor Detail

XhWatch

public XhWatch()
Constructor.

Method Detail

initialize

public void initialize()
Description copied from interface: IXholon
Initialize the tree node. Typically this is only used to re-initialize a node, such as when it is reused through the TreeNodeFactoryStatic.

Specified by:
initialize in interface IXholon
Overrides:
initialize in class XholonWithPorts

setRoleName

public void setRoleName(java.lang.String roleName)
Description copied from interface: IXholon
Set name of the role played by this Xholon within a specific context.

Specified by:
setRoleName in interface IXholon
Overrides:
setRoleName in class Xholon

getRoleName

public java.lang.String getRoleName()
Description copied from interface: IXholon
Get name of the role played by this Xholon within a specific context.

Specified by:
getRoleName in interface IXholon
Overrides:
getRoleName in class Xholon

act

public void act()
Description copied from interface: IXholon
Do some action during this time step. Typically all nodes in the tree will do their pre-actions (optional), then all will do their actions, and then all will do their post-actions (optional).

Specified by:
act in interface IXholon
Overrides:
act in class Xholon

processReceivedMessage

public void processReceivedMessage(Message msg)
Description copied from interface: IXholon
Process a received ROOM/UML2 message taken from the message queue. All sent messages are placed in queues before they are processed.

Specified by:
processReceivedMessage in interface IXholon
Overrides:
processReceivedMessage in class Xholon

performActivity

public void performActivity(int activityId,
                            IMessage msg)
Description copied from interface: IXholon
Do the UML2 Activity identified by the activityId. This is code called during a state Transition, or while entering, exiting, or within a State.

Specified by:
performActivity in interface IXholon
Overrides:
performActivity in class Xholon

handleNodeSelection

public java.lang.String handleNodeSelection()
Description copied from interface: IXholon
Handle selection of a tree node by a user, as when a person clicks on a JTree node in the default viewer. Any action performed here should be minimal. Ideally there should be no side effects. WARNING: There may be thread issues.

Specified by:
handleNodeSelection in interface IXholon
Overrides:
handleNodeSelection in class Xholon

toString

public java.lang.String toString()
Overrides:
toString in class Xholon