gishur.graph.core
Class Edge

java.lang.Object
  |
  +--gishur.graph.core.GraphElement
        |
        +--gishur.graph.core.Edge
All Implemented Interfaces:
java.lang.Cloneable, Cloneable, ControlledCloneable, KeyValueHolder, java.io.Serializable

public class Edge
extends GraphElement

The basic Edge class for arbitrary Graphs. Most of its functionality is inherited from GraphElement, e.g. the property handling methods and the connection handling.

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
Edge()
          Empty constructor, returns a new, unnamed Edge.
Edge(int i)
          Constructs an Edge with the i'th automatically generated name.
Edge(java.lang.String name)
          Constructor returning a Node named with the given name.
Edge(java.lang.String name, java.lang.Object key)
          Constructor returning a Node named with the given name and with key key.
Edge(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).
static java.lang.String generateName(int i)
          Get generic name.
 Node opposite(GraphElement u)
          Returns the Node which is connected opposite to u to this Edge, i.e. the target node if u is the source and vice versa.
 Node source()
          Returns the source Node of this Edge.
 Node target()
          Returns the target Node of this Edge.
 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

Edge

public Edge()
Empty constructor, returns a new, unnamed Edge.

Edge

public Edge(int i)
Constructs an Edge with the i'th automatically generated name.

Edge

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

Edge

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

Edge

public Edge(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). The link list representation consists here of a partial string of the form source->target.
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

source

public Node source()
Returns the source Node of this Edge.
Returns:
the source Node

target

public Node target()
Returns the target Node of this Edge.
Returns:
the target Node

opposite

public Node opposite(GraphElement u)
Returns the Node which is connected opposite to u to this Edge, i.e. the target node if u is the source and vice versa.
Parameters:
u - a Node adjacent to this Edge
Returns:
the opposite Node, if u is adjacent to this Edge or null otherwise

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 Node, 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