org.primordion.xholon.base
Class AbstractGrid

java.lang.Object
  extended byorg.primordion.xholon.base.Xholon
      extended byorg.primordion.xholon.base.XholonWithPorts
          extended byorg.primordion.xholon.base.AbstractGrid
All Implemented Interfaces:
IGrid, IXholon
Direct Known Subclasses:
GridEntity, PatchOwner, Xh09SpatialGames, Xh1dSimple, XhAntForaging, XhAntTrail, XhBrenda, XhCombo, XhGameOfLife, XhHex

public abstract class AbstractGrid
extends XholonWithPorts
implements IGrid

AbstractGrid is an abstract class that your detailed behavior class (ex: XhGameOfLife) should extend if it contains a grid superimposed on some portion of the tree.

Since:
0.1 (Created on Jul 9, 2005)
Author:
Ken Webb
See Also:
IGrid

Field Summary
static int P_BEHAVIOR
           
static int P_NEXT
           
static int P_PREVIOUS
           
 
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.IGrid
BOUNDARY_GRID, BOUNDARY_TORUS, NEIGHBORHOOD_1DCA, NEIGHBORHOOD_HEXAGONAL, NEIGHBORHOOD_MOORE, NEIGHBORHOOD_SIBLING, NEIGHBORHOOD_VON_NEUMANN, P_CAFUTURESELF, P_CALEFTNEIGHBOR, P_CARIGHTNEIGHBOR, P_EAST, P_HEX0, P_HEX1, P_HEX2, P_HEX3, P_HEX4, P_HEX5, P_NORTH, P_NORTHEAST, P_NORTHWEST, P_SOUTH, P_SOUTHEAST, P_SOUTHWEST, P_STAYHERE, P_WEST, REGULAR_COMPLETE, REGULAR_COMPLETE_SELF, REGULAR_CYCLE, REGULAR_WHEEL
 
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
AbstractGrid()
          Constructor.
 
Method Summary
 int configure(java.lang.String instructions, int instructIx)
          Configure something based on a configure instruction.
 int getNeighType()
          Get the neighborhood type, as defined in IGrid.
 int getNumNeighbors()
          Get the number of neighbors that a grid cell has.
 void initialize()
          Initialize the tree node.
 void moveXholonsToGrid(IXholon xhParent, boolean allowMultiple)
          Move a set of xholons randomly into a grid structure.
 void postConfigure()
          Perform some action, typically once at start up; MAY be overridden.
 void postReconfigure()
          Post-reconfigure.
 void preReconfigure()
          Pre-Reconfigure, such as at the start of a new GP generation.
 void reconfigure()
          Reconfigure, such as at the start of a new GP generation.
 void setCaFuture()
          Set reference to Future Self link, if this is a 1D CA grid.
 void setCaLeft()
          Set reference to Left Neighbor link, if this is a 1D CA grid.
 void setCaRight()
          Set reference to Right Neighbor link, if this is a 1D CA grid.
 void setEast()
          Set reference to east link, if this is a grid.
 void setHex0()
          Set reference to Hex0 (top) link, if this is a hexagonal grid.
 void setHex1()
          Set reference to Hex1 link, if this is a hexagonal grid.
 void setHex2()
          Set reference to Hex2 link, if this is a hexagonal grid.
 void setHex3()
          Set reference to Hex3 link, if this is a hexagonal grid.
 void setHex4()
          Set reference to Hex4 link, if this is a hexagonal grid.
 void setHex5()
          Set reference to Hex5 link, if this is a hexagonal grid.
 void setNorth()
          Set reference to north link, if this is a grid.
 void setNorthEast()
          Set reference to north east link, if this is a grid.
 void setNorthWest()
          Set reference to north west link, if this is a grid.
 void setSiblingsComplete()
          Set references to all siblings, if this is a complete graph.
 void setSiblingsCompleteSelf()
          Set references to all siblings and to self, if this is a complete graph including self.
 void setSiblingsCycle()
          Set references to two adjacent siblings, if this is a cycle.
 void setSiblingsWheel()
          Set references to two adjacent siblings, and to parent, if this is a wheel.
 void setSouth()
          Set reference to south link, if this is a grid.
 void setSouthEast()
          Set reference to south east link, if this is a grid.
 void setSouthWest()
          Set reference to south west link, if this is a grid.
 void setWest()
          Set reference to west link, if this is a grid.
 
Methods inherited from class org.primordion.xholon.base.XholonWithPorts
configure, getMaxPorts, getPort, isActiveObject, isBound, isContainer, isPassiveObject, setMaxPorts, setPorts, terminate
 
Methods inherited from class org.primordion.xholon.base.Xholon
act, appendChild, appendChild, appendChild, cleanup, createStructure, decVal, decVal, depth, draw, getChildNodes, getFirstChild, getFirstSibling, getId, getLastChild, getLastSibling, getName, getNeighbors, getNextId, getNextSibling, getNthChild, getNthSibling, getNumChildren, getNumSiblings, getParentNode, getPreviousSibling, getRoleName, 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, handleNodeSelection, hasAncestor, hasChildNodes, hasChildOrSiblingNodes, hasNextSibling, hasParentNode, height, incVal, incVal, initStatics, inOrderPrint, insertAfter, insertBefore, insertFirstChild, isExternal, isInternal, isLeaf, isRootNode, performActivity, performActivity, performBooleanActivity, performBooleanActivity, performDoubleActivity, performGuard, performVoidActivity, postAct, postOrderPrint, preAct, preConfigure, preOrderPrint, print, println, processMessageQ, processReceivedMessage, remove, removeChild, resetNextId, sendMessage, sendMessage, sendMessage, setAttributeVal, setFactory, setFirstChild, setId, setNextSibling, setParentChildLinks, setParentNode, setParentSiblingLinks, setRoleName, setSizeMessageQ, setUid, setVal, setVal, setVal, setVal, setVal, setVal, setVal, setVal, setVal, setVal, setVariableValue, setXhc, swapNode, toString, treeSize, writeXml
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

P_BEHAVIOR

public static final int P_BEHAVIOR
See Also:
Constant Field Values

P_NEXT

public static final int P_NEXT
See Also:
Constant Field Values

P_PREVIOUS

public static final int P_PREVIOUS
See Also:
Constant Field Values
Constructor Detail

AbstractGrid

public AbstractGrid()
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

getNeighType

public int getNeighType()
Description copied from interface: IGrid
Get the neighborhood type, as defined in IGrid.

Specified by:
getNeighType in interface IGrid
Returns:
The neighborhood type.

getNumNeighbors

public int getNumNeighbors()
Description copied from interface: IGrid
Get the number of neighbors that a grid cell has.

Specified by:
getNumNeighbors in interface IGrid
Returns:
The number of neighbors.

configure

public int configure(java.lang.String instructions,
                     int instructIx)
Description copied from interface: IXholon
Configure something based on a configure instruction.

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

postConfigure

public void postConfigure()
Description copied from interface: IXholon
Perform some action, typically once at start up; MAY be overridden. Recursive; application should call this only for root.

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

preReconfigure

public void preReconfigure()
Description copied from interface: IXholon
Pre-Reconfigure, such as at the start of a new GP generation.

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

reconfigure

public void reconfigure()
Description copied from interface: IXholon
Reconfigure, such as at the start of a new GP generation.

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

postReconfigure

public void postReconfigure()
Description copied from interface: IXholon
Post-reconfigure.

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

setNorth

public void setNorth()
Description copied from interface: IGrid
Set reference to north link, if this is a grid.

Specified by:
setNorth in interface IGrid

setSouth

public void setSouth()
Description copied from interface: IGrid
Set reference to south link, if this is a grid.

Specified by:
setSouth in interface IGrid

setWest

public void setWest()
Description copied from interface: IGrid
Set reference to west link, if this is a grid.

Specified by:
setWest in interface IGrid

setEast

public void setEast()
Description copied from interface: IGrid
Set reference to east link, if this is a grid.

Specified by:
setEast in interface IGrid

setNorthEast

public void setNorthEast()
Description copied from interface: IGrid
Set reference to north east link, if this is a grid.

Specified by:
setNorthEast in interface IGrid

setSouthEast

public void setSouthEast()
Description copied from interface: IGrid
Set reference to south east link, if this is a grid.

Specified by:
setSouthEast in interface IGrid

setSouthWest

public void setSouthWest()
Description copied from interface: IGrid
Set reference to south west link, if this is a grid.

Specified by:
setSouthWest in interface IGrid

setNorthWest

public void setNorthWest()
Description copied from interface: IGrid
Set reference to north west link, if this is a grid.

Specified by:
setNorthWest in interface IGrid

setHex0

public void setHex0()
Description copied from interface: IGrid
Set reference to Hex0 (top) link, if this is a hexagonal grid.

Specified by:
setHex0 in interface IGrid

setHex1

public void setHex1()
Description copied from interface: IGrid
Set reference to Hex1 link, if this is a hexagonal grid.

Specified by:
setHex1 in interface IGrid

setHex2

public void setHex2()
Description copied from interface: IGrid
Set reference to Hex2 link, if this is a hexagonal grid.

Specified by:
setHex2 in interface IGrid

setHex3

public void setHex3()
Description copied from interface: IGrid
Set reference to Hex3 link, if this is a hexagonal grid.

Specified by:
setHex3 in interface IGrid

setHex4

public void setHex4()
Description copied from interface: IGrid
Set reference to Hex4 link, if this is a hexagonal grid.

Specified by:
setHex4 in interface IGrid

setHex5

public void setHex5()
Description copied from interface: IGrid
Set reference to Hex5 link, if this is a hexagonal grid.

Specified by:
setHex5 in interface IGrid

setCaLeft

public void setCaLeft()
Description copied from interface: IGrid
Set reference to Left Neighbor link, if this is a 1D CA grid.

Specified by:
setCaLeft in interface IGrid

setCaRight

public void setCaRight()
Description copied from interface: IGrid
Set reference to Right Neighbor link, if this is a 1D CA grid.

Specified by:
setCaRight in interface IGrid

setCaFuture

public void setCaFuture()
Description copied from interface: IGrid
Set reference to Future Self link, if this is a 1D CA grid.

Specified by:
setCaFuture in interface IGrid

setSiblingsComplete

public void setSiblingsComplete()
Description copied from interface: IGrid
Set references to all siblings, if this is a complete graph.

Specified by:
setSiblingsComplete in interface IGrid

setSiblingsCompleteSelf

public void setSiblingsCompleteSelf()
Description copied from interface: IGrid
Set references to all siblings and to self, if this is a complete graph including self.

Specified by:
setSiblingsCompleteSelf in interface IGrid

setSiblingsCycle

public void setSiblingsCycle()
Description copied from interface: IGrid
Set references to two adjacent siblings, if this is a cycle.

Specified by:
setSiblingsCycle in interface IGrid

setSiblingsWheel

public void setSiblingsWheel()
Description copied from interface: IGrid
Set references to two adjacent siblings, and to parent, if this is a wheel.

Specified by:
setSiblingsWheel in interface IGrid

moveXholonsToGrid

public void moveXholonsToGrid(IXholon xhParent,
                              boolean allowMultiple)
Description copied from interface: IGrid
Move a set of xholons randomly into a grid structure. All immediate children of the parent node will be moved. This method should be called on the grid owner.

Specified by:
moveXholonsToGrid in interface IGrid
Parameters:
xhParent - The parent of the xholons that should be moved.
allowMultiple - Whether multiple xholons are allowed in the same grid cell.