com.lexonics.edsel
Class Edge

java.lang.Object
  extended bycom.lexonics.edsel.Edge

public final class Edge
extends Object

An Edsel edge. An Edge has a source, a name, and a destination list. The source is a non-null Node. The name is a valid Edsel identifier; that is, it is a non-null, non-empty String that contains no characters other than upper- and lowercase ASCII letters, digits, and hyphens. Names beginning with hyphens are reserved. By convention, edge names are lowercase words separated by hyphens. The destination list is a non-null List of Nodes. Edges are immutable.


Constructor Summary
Edge(Node source, String name, List destinationList)
          Construct an Edge with a given source, name, and destination list.
Edge(Node source, String name, Node destination)
          Construct an Edge with a given source and name, and a destination list containing a single destination.
 
Method Summary
 List destinationList()
          Return a shallow copy of the destination list of this Edge.
 boolean equals(Object o)
          Compare a given object with this Edge for equality.
 int hashCode()
          Return the hash code value for this Edge.
 String name()
          Return the name of this Edge.
 Node source()
          Return the source of this Edge.
 String toString()
          Return a string representation of this Edge.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Edge

public Edge(Node source,
            String name,
            Node destination)
Construct an Edge with a given source and name, and a destination list containing a single destination.

Parameters:
source - The source. Must be non-null.
name - The name. Must be a valid Edsel identifier.
destination - The destination. Must be non-null.
Throws:
IllegalArgumentException - The source is null, the name is not a valid Edsel identifier, or the destination is null.

Edge

public Edge(Node source,
            String name,
            List destinationList)
Construct an Edge with a given source, name, and destination list.

Parameters:
source - The source. Must be non-null.
name - The name. Must be a valid Edsel identifier.
destinationList - The destination list. Must be a non-null List of Nodes. This list is copied by a shallow copy, to guarantee Edge immutability.
Throws:
IllegalArgumentException - The source is null, the name is not a valid Edsel identifier, the destination list is null, or an element of the destination list is not a Node.
Method Detail

destinationList

public List destinationList()
Return a shallow copy of the destination list of this Edge.

Returns:
A shallow copy of the destination list of this Edge.

equals

public boolean equals(Object o)
Compare a given object with this Edge for equality. Return true if the given object is also an Edge, and the two Edges have equal sources, names, and destination lists.

Parameters:
o - The object.
Returns:
true if the object is equal to this Edge.

hashCode

public int hashCode()
Return the hash code value for this Edge. The hash code of an Edge is defined to be the sum of the hash codes of its source, name, and destination list.

Returns:
The hash code value for this Edge.

name

public String name()
Return the name of this Edge.

Returns:
The name of this Edge.

source

public Node source()
Return the source of this Edge.

Returns:
The source of this Edge.

toString

public String toString()
Return a string representation of this Edge.

Returns:
The string representation.


Copyright, 2003
Lexonics, Inc.
All Rights Reserved