gishur.graph.core
Class Node

java.lang.Object
  |
  +--gishur.graph.core.GraphElement
        |
        +--gishur.graph.core.Node
All Implemented Interfaces:
java.lang.Cloneable, Cloneable, ControlledCloneable, KeyValueHolder, java.io.Serializable
Direct Known Subclasses:
Graph

public class Node
extends GraphElement

Basic node class for Graphs. Most of its functionality is inherited from GraphElement, e.g. the methods for connections to other GraphElements (which may here only be Edges).

Version:
1.0
Author:
Christoph Sachse
See Also:
Serialized Form

Fields inherited from class gishur.graph.core.GraphElement
ACCESS_CONNECT, ACCESS_REMOVE, BOTH, DETAILED, IN, LINK_ALL, NORMAL, OUT, SET_KEY, SET_VALUE, SHORT, VERY_DETAILED
 
Fields inherited from interface gishur.core.ControlledCloneable
DEEP, FLAT
 
Constructor Summary
Node()
          Empty constructor, returns a new automatically named Node.
Node(int i)
          Constructs a Node with the i'th automatically generated name.
Node(java.lang.String name)
          Constructor returning a Node named with the given name.
Node(java.lang.String name, java.lang.Object key)
          Constructor returning a Node named with the given name and with key key.
Node(java.lang.String name, java.lang.Object key, java.lang.Object value)
          Constructor returning a Node named with the given name and with key key and value value.
 
Method Summary
protected  boolean checkAccess(int access, java.lang.Object argument)
          Overrides GraphElement.checkAccess(int, java.lang.Object).
 int degree(Graph g)
          Returns the number of Edges connected to this Node.
static java.lang.String generateName(int i)
          Get generic name.
 int inDegree(Graph g)
          Returns the number of ingoing Edges from this Node.
 int outDegree(Graph g)
          Returns the number of outgoing Edges from this Node.
 java.lang.Object preferredPosition()
          Returns the preferred position of this Node.
 void setPreferredPosition(java.lang.Object position)
          Sets the preferred position for Visualizations.
 java.lang.String toString(int level)
          Returns a string representation of this Edge in a definable level of detail.
 
Methods inherited from class gishur.graph.core.GraphElement
addOwner, checkState, checkStateCleared, clearState, clone, clone, countConnectedElements, createFlow, createFlow, cursor, cursor, element, flow, getBoolProperty, getDoubleProperty, getEdgeProperty, getFloatProperty, getGraphElementProperty, getIntProperty, getLongProperty, getNodeProperty, getProperties, getProperty, getProperty, getShortProperty, getSortedProperties, getSortedProperties, hasProperty, isConnectedTo, isOwner, key, linkListToString, linkTypeToString, name, opposite, ownerListToString, propertiesToString, removeAllProperties, removeFlow, removePropertiesStartingWith, removeProperty, setKey, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setState, setValue, state, state, toString, value
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Node

public Node()
Empty constructor, returns a new automatically named Node.

Node

public Node(int i)
Constructs a Node with the i'th automatically generated name.

Node

public Node(java.lang.String name)
Constructor returning a Node named with the given name.

Node

public Node(java.lang.String name,
            java.lang.Object key)
Constructor returning a Node named with the given name and with key key.

Node

public Node(java.lang.String name,
            java.lang.Object key,
            java.lang.Object value)
Constructor returning a Node named with the given name and with key key and value value.
Method Detail

generateName

public static final java.lang.String generateName(int i)
Get generic name.
Parameters:
i - the instancenumber

toString

public java.lang.String toString(int level)
Returns a string representation of this Edge in a definable level of detail. level can be one of the constants GraphElement.SHORT,GraphElement.NORMAL, GraphElement.DETAILED or GraphElement.VERY_DETAILED. For information about these levels, see GraphElement.toString(int).
Overrides:
toString in class GraphElement
Parameters:
level - the requested level of detail: GraphElement.SHORT,GraphElement.NORMAL, GraphElement.DETAILED or GraphElement.VERY_DETAILED
Returns:
a string representation of this Edge

setPreferredPosition

public void setPreferredPosition(java.lang.Object position)
Sets the preferred position for Visualizations. The given value should be realizable by the visualization objects used to visualize this node/graph.
Parameters:
position - the position information

preferredPosition

public java.lang.Object preferredPosition()
Returns the preferred position of this Node.
Returns:
the preferred position of this Node.

inDegree

public int inDegree(Graph g)
Returns the number of ingoing Edges from this Node.

outDegree

public int outDegree(Graph g)
Returns the number of outgoing Edges from this Node.

degree

public int degree(Graph g)
Returns the number of Edges connected to this Node.

checkAccess

protected boolean checkAccess(int access,
                              java.lang.Object argument)
Overrides GraphElement.checkAccess(int, java.lang.Object). The method returns true, if argument is of type Edge, false otherwise.
Overrides:
checkAccess in class GraphElement
Parameters:
access - an access constant specifying the requested operation
argument - the argument of the requested operation
Returns:
true, if the operation is allowed, false otherwise