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
-
color
- Status of the Edge.
-
flow
- Flow of the Edge.
-
fromNode
- Indicate node that edge begins with.
-
normalColor
- Default color of the normal Edge.
-
NUL
- Indicate null item
-
toNode
- Indicate node that edge ends with.
-
untouchedColor
- Default color of the untouched Edge.
-
weight
- Weight of the Edge.
-
Edge()
- Constructs a dummy edge.
-
Edge(int, int, double, double)
- Constructs an edge with specified data.
-
Edge(int, int, double, double, Color)
- Constructs an edge with specified data and color.
-
clean()
- Clean all special attribute.
-
clone()
- Returns a deep-copied clone of this Edge.
-
compareTo(Object)
- Compares edges with their weight.
-
copyFrom(Edge)
- Copies the components from specified Edge to this Edge
-
getColor()
- Get the color of edge.
-
getDefaultColor()
- Get the default color of edge.
-
getFlow()
- Get the flow of edge.
-
getFromNode()
- Get the start node of edge.
-
getToNode()
- Get the end node of edge.
-
getWeight()
- Get the weight of edge.
-
reset()
- Reset color attribute.
-
reverseDirection()
- Reverse the direction of this edge.
-
setColor(Color)
- Set the color of edge.
-
setDefaultColor(Color)
- Set the default color of edge.
-
setFlow(double)
- Set the flow of edge.
-
setFromNode(int)
- Set the start node of edge.
-
setToNode(int)
- Set the end node of edge.
-
setVertices(int, int)
- Set the both end of edge
-
setWeight(double)
- Set the weight of edge.
NUL
public static final int NUL
- Indicate null item
fromNode
protected int fromNode
- Indicate node that edge begins with.
toNode
protected int toNode
- Indicate node that edge ends with.
weight
protected double weight
- Weight of the Edge.
flow
protected double flow
- Flow of the Edge.
normalColor
public static Color normalColor
- Default color of the normal Edge.
untouchedColor
public static Color untouchedColor
- Default color of the untouched Edge.
color
protected Color color
- Status of the Edge. Use color-representation.
Edge
public Edge()
- Constructs a dummy edge.
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
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
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
reset
public void reset()
- Reset color attribute.
Reset the following attribute:
color=normalColor;
- See Also:
- clear
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
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.
copyFrom
public void copyFrom(Edge src)
- Copies the components from specified Edge to this Edge
- Parameters:
- src - the source Edge
getColor
public Color getColor()
- Get the color of edge.
- Returns:
- the color of edge.
setColor
public void setColor(Color color)
- Set the color of edge.
- Parameters:
- color - the color of edge.
getFlow
public double getFlow()
- Get the flow of edge.
- Returns:
- the flow of edge.
setFlow
public void setFlow(double flow)
- Set the flow of edge.
- Parameters:
- flow - the flow of edge.
getDefaultColor
public Color getDefaultColor()
- Get the default color of edge.
- Returns:
- the default color of edge.
setDefaultColor
public void setDefaultColor(Color color)
- Set the default color of edge.
- Parameters:
- color - the default color of edge.
getFromNode
public int getFromNode()
- Get the start node of edge.
- Returns:
- the start node of edge.
setFromNode
public void setFromNode(int fromNode)
- Set the start node of edge.
- Parameters:
- fromNode - the start node of edge.
getToNode
public int getToNode()
- Get the end node of edge.
- Returns:
- the end node of edge.
setToNode
public void setToNode(int toNode)
- Set the end node of edge.
- Parameters:
- toNode - the end node of edge.
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
reverseDirection
public void reverseDirection()
- Reverse the direction of this edge.
getWeight
public double getWeight()
- Get the weight of edge.
- Returns:
- the weight of edge.
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