All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class tw.edu.ncnu.im.cnclab.JGAP.Edge

java.lang.Object
   |
   +----tw.edu.ncnu.im.cnclab.JGAP.Edge

public class Edge
extends Object
implements Cloneable, Comparable11, Serializable
The Edge class implements data structure of edge of graphs.

Version:
0.4 Jul 8, 1999
Author:
Ding-Yi Chen
See Also:
Enumeration, Vertex, Graph

Variable Index

 o color
Status of the Edge.
 o flow
Flow of the Edge.
 o fromNode
Indicate node that edge begins with.
 o normalColor
Default color of the normal Edge.
 o NUL
Indicate null item
 o toNode
Indicate node that edge ends with.
 o untouchedColor
Default color of the untouched Edge.
 o weight
Weight of the Edge.

Constructor Index

 o Edge()
Constructs a dummy edge.
 o Edge(int, int, double, double)
Constructs an edge with specified data.
 o Edge(int, int, double, double, Color)
Constructs an edge with specified data and color.

Method Index

 o clean()
Clean all special attribute.
 o clone()
Returns a deep-copied clone of this Edge.
 o compareTo(Object)
Compares edges with their weight.
 o copyFrom(Edge)
Copies the components from specified Edge to this Edge
 o getColor()
Get the color of edge.
 o getDefaultColor()
Get the default color of edge.
 o getFlow()
Get the flow of edge.
 o getFromNode()
Get the start node of edge.
 o getToNode()
Get the end node of edge.
 o getWeight()
Get the weight of edge.
 o reset()
Reset color attribute.
 o reverseDirection()
Reverse the direction of this edge.
 o setColor(Color)
Set the color of edge.
 o setDefaultColor(Color)
Set the default color of edge.
 o setFlow(double)
Set the flow of edge.
 o setFromNode(int)
Set the start node of edge.
 o setToNode(int)
Set the end node of edge.
 o setVertices(int, int)
Set the both end of edge
 o setWeight(double)
Set the weight of edge.

Variables

 o NUL
 public static final int NUL
Indicate null item

 o fromNode
 protected int fromNode
Indicate node that edge begins with.

 o toNode
 protected int toNode
Indicate node that edge ends with.

 o weight
 protected double weight
Weight of the Edge.

 o flow
 protected double flow
Flow of the Edge.

 o normalColor
 public static Color normalColor
Default color of the normal Edge.

 o untouchedColor
 public static Color untouchedColor
Default color of the untouched Edge.

 o color
 protected Color color
Status of the Edge. Use color-representation.

Constructors

 o Edge
 public Edge()
Constructs a dummy edge.

 o Edge
 public Edge(int fromNode,
             int toNode,
             double weight,
             double flow)
Constructs an edge with specified data.

Parameters:
fromNode - Node that edge begin with.
toNode - Node that edge end with.
weight - Edge weight
flow - Initial flow
 o Edge
 public Edge(int fromNode,
             int toNode,
             double weight,
             double flow,
             Color color)
Constructs an edge with specified data and color.

Parameters:
fromNode - Node that edge begin with.
toNode - Node that edge end with.
weight - Edge weight
flow - Initial flow
color - Color of edge

Methods

 o clean
 public void clean()
Clean all special attribute.

It will call reset() and reset the following attribute:

   color=normalColor;
   flow=0.0;
   

See Also:
reset
 o reset
 public void reset()
Reset color attribute.

Reset the following attribute:

   color=normalColor;
   

See Also:
clear
 o clone
 public Object clone()
Returns a deep-copied clone of this Edge.

Returns:
a deep-copied clone of this Edge.
Overrides:
clone in class Object
 o compareTo
 public int compareTo(Object rhs) throws ClassCastException
Compares edges with their weight.

Parameters:
rhs - the other Edge object.
Returns:
0 if two objects are equal; -1 if this object is smaller; 1 if this object is larger.
Throws: ClassCastException
if rhs is no a Edge.
 o copyFrom
 public void copyFrom(Edge src)
Copies the components from specified Edge to this Edge

Parameters:
src - the source Edge
 o getColor
 public Color getColor()
Get the color of edge.

Returns:
the color of edge.
 o setColor
 public void setColor(Color color)
Set the color of edge.

Parameters:
color - the color of edge.
 o getFlow
 public double getFlow()
Get the flow of edge.

Returns:
the flow of edge.
 o setFlow
 public void setFlow(double flow)
Set the flow of edge.

Parameters:
flow - the flow of edge.
 o getDefaultColor
 public Color getDefaultColor()
Get the default color of edge.

Returns:
the default color of edge.
 o setDefaultColor
 public void setDefaultColor(Color color)
Set the default color of edge.

Parameters:
color - the default color of edge.
 o getFromNode
 public int getFromNode()
Get the start node of edge.

Returns:
the start node of edge.
 o setFromNode
 public void setFromNode(int fromNode)
Set the start node of edge.

Parameters:
fromNode - the start node of edge.
 o getToNode
 public int getToNode()
Get the end node of edge.

Returns:
the end node of edge.
 o setToNode
 public void setToNode(int toNode)
Set the end node of edge.

Parameters:
toNode - the end node of edge.
 o setVertices
 public void setVertices(int fromNode,
                         int toNode)
Set the both end of edge

Parameters:
fromNode - the start node of edge
toNode - the end node of edge
 o reverseDirection
 public void reverseDirection()
Reverse the direction of this edge.

 o getWeight
 public double getWeight()
Get the weight of edge.

Returns:
the weight of edge.
 o setWeight
 public void setWeight(double weight)
Set the weight of edge.

Parameters:
weight - the weight of edge.

All Packages  Class Hierarchy  This Package  Previous  Next  Index