org.cfpm.caves.za
Class NetworkNode

java.lang.Object
  extended by uchicago.src.sim.network.DefaultNode
      extended by uchicago.src.sim.network.DefaultDrawableNode
          extended by org.cfpm.caves.za.NetworkNode
All Implemented Interfaces:
uchicago.src.sim.gui.Drawable2DGridNode, uchicago.src.sim.gui.DrawableNonGridNode, uchicago.src.sim.gui.Moveable, uchicago.src.sim.gui.NonGridDrawable, uchicago.src.sim.network.Node

public class NetworkNode
extends uchicago.src.sim.network.DefaultDrawableNode

A node in a (social) network; refers to a person or household. Was originally planned to be used as shadow fact in Jess, together with the link class, so that all networks would be represented as nodes and links to be simultaneously "visible" in Jess and Java and displayable in Repast. Alas, it turned out that this wasn't the most efficient way to represent networks so it was more or less completely dropped. Persons and households still have nodes and the kinship network and friend network are maintained as links if the GUI is switched on.

Author:
Ruth Meyer

Nested Class Summary
 
Nested classes/interfaces inherited from class uchicago.src.sim.network.DefaultNode
uchicago.src.sim.network.DefaultNode.OrderedHashMap
 
Field Summary
(package private)  jess.Value id
          the node id
private  java.beans.PropertyChangeSupport pcs
           
 
Fields inherited from class uchicago.src.sim.network.DefaultDrawableNode
item
 
Fields inherited from class uchicago.src.sim.network.DefaultNode
inEdges, inMap, label, outEdges, outMap
 
Constructor Summary
NetworkNode()
          Parameterless constructor.
NetworkNode(jess.Value id)
          Creates a new network node with the given id.
 
Method Summary
private  java.lang.String abbreviate(jess.Value id)
          internal helper function: abbreviates the node id to be used as the node label
 void addInEdge(NetworkLink link)
          adds the given link as an incoming edge
 void addOutEdge(NetworkLink link)
          adds the given link as an outgoing edge
 void addPropertyChangeListener(java.beans.PropertyChangeListener p)
          adds a property change listener (for Jess)
 boolean equals(java.lang.Object o)
          Compare the given object to this node.
 jess.Value getId()
          returns the node id
private  void init()
          internal function: creates the graphical representation of the node
 void removeFromLinks(java.lang.String type)
          removes the outgoing links of the specified type
 void removePropertyChangeListener(java.beans.PropertyChangeListener p)
          removes a property change listener (for Jess)
 void setId(java.lang.String newId)
          sets the node id
 void setId(jess.Value newId)
          sets the node id
 java.lang.String toString()
          returns a String representation of this node
 
Methods inherited from class uchicago.src.sim.network.DefaultDrawableNode
allowResizing, calcSize, contains, draw, getBorderColor, getBorderWidth, getColor, getFont, getHeight, getLabelColor, getNode, getWidth, getX, getY, setBorderColor, setBorderWidth, setColor, setDrawable, setDrawableNoCopy, setFont, setHeight, setLabelColor, setNodeLabel, setWidth, setX, setX, setY, setY
 
Methods inherited from class uchicago.src.sim.network.DefaultNode
addInEdge, addInEdges, addOutEdge, addOutEdges, clearInEdges, clearOutEdges, getEdgesFrom, getEdgesTo, getFromNodes, getInDegree, getInEdges, getInNodes, getNodeLabel, getNumInEdges, getNumOutEdges, getOutDegree, getOutEdges, getOutNodes, getRandomFromNode, getRandomNodeIn, getRandomNodeOut, getRandomToNode, getToNodes, hasEdgeFrom, hasEdgeTo, hasEdgeToOrFrom, makeRandomInEdge, makeRandomOutEdge, removeEdgesFrom, removeEdgesTo, removeInEdge, removeOutEdge
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface uchicago.src.sim.gui.DrawableNonGridNode
getOutEdges
 
Methods inherited from interface uchicago.src.sim.gui.Drawable2DGridNode
getOutEdges
 

Field Detail

id

jess.Value id
the node id


pcs

private java.beans.PropertyChangeSupport pcs
Constructor Detail

NetworkNode

public NetworkNode()
Parameterless constructor. Creates a new "empty" network node.


NetworkNode

public NetworkNode(jess.Value id)
Creates a new network node with the given id. This is either the associated person's name or the associated household's id.

Parameters:
id - the node id
Method Detail

init

private void init()
internal function: creates the graphical representation of the node


setId

public void setId(jess.Value newId)
sets the node id

Parameters:
newId - the node's new id

setId

public void setId(java.lang.String newId)
sets the node id

Parameters:
newId - the node's new id as a String

abbreviate

private java.lang.String abbreviate(jess.Value id)
internal helper function: abbreviates the node id to be used as the node label


getId

public jess.Value getId()
returns the node id

Specified by:
getId in interface uchicago.src.sim.network.Node
Overrides:
getId in class uchicago.src.sim.network.DefaultNode
Returns:
the node id

addInEdge

public void addInEdge(NetworkLink link)
adds the given link as an incoming edge

Parameters:
link - the network link

addOutEdge

public void addOutEdge(NetworkLink link)
adds the given link as an outgoing edge

Parameters:
link - the network link

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener p)
adds a property change listener (for Jess)


removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener p)
removes a property change listener (for Jess)


toString

public java.lang.String toString()
returns a String representation of this node

Overrides:
toString in class java.lang.Object
Returns:
String made out of the word "Node" and the node's label

equals

public boolean equals(java.lang.Object o)
Compare the given object to this node. Needed for tests in contains() operation of node lists.

Overrides:
equals in class java.lang.Object
Parameters:
o - the object to compare with
Returns:
true if the given object is (a) identical with this node or (b) of type NetworkNode and has the same id; false otherwise

removeFromLinks

public void removeFromLinks(java.lang.String type)
removes the outgoing links of the specified type

Parameters:
type - the link type