Jedit 4.1

edu.bsu.cs.graph
Class Edge

java.lang.Object
  |
  +--edu.bsu.cs.graph.Edge
All Implemented Interfaces:
Serializable

public class Edge
extends Object
implements Serializable

The base class for implementing a graph edge. An Edge consists of the following attributes: weight, weight2, label, edgeColor, and marked.

Since:
9 Nov 1997
Version:
03 Jan 2003
Author:
Aaron Nall
, Elizabeth VandenBerg
See Also:
Serialized Form

Field Summary
protected  Color DEFAULTCOLOR
          The default Edge color.
 
Constructor Summary
protected Edge()
          Default constructor.
protected Edge(Edge source)
          Cloning constructor.
 
Method Summary
protected  Color getColor()
          Returns the color of the Edge.
protected  String getLabel()
          Returns the string label of the Edge.
protected  double getWeight()
          Returns the value of weight of the Edge.
protected  double getWeight2()
          Returns the value of weight2 of the Edge.
protected  boolean isMarked()
          Returns true if Edge is marked.
protected  void mark()
          Marks the Edge by setting an internal attribute marked to true and by setting the attribute edgeColor to JeditFrame.DEFAULT_MARKED_COLOR.
protected  void setColor(Color newColor)
          Sets the color of the Edge to be the value of newColor.
protected  void setLabel(String newLabel)
          Sets the value of the label of the edge to be newLabel.
protected  void setWeight(double newWeight)
          Sets the value of weight of the Edge to be newWeight.
protected  void setWeight2(double newWeight)
          Sets the value of weight2 of the Edge to be newWeight.
 String toString()
          Returns a string in the form of [label]:[weight].
protected  void unmark()
          Unmarks the Edge by setting an internal attribute marked to false and by setting the attribute edgeColor to JeditFrame.DEFAULT_EDGE_COLOR.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULTCOLOR

protected final Color DEFAULTCOLOR
The default Edge color.

Since:
01 Jun 2002
Constructor Detail

Edge

protected Edge()
Default constructor. Sets internal private values with the following defaults:
weight = 1.0
weight2 = 0.0
label = {blank string}
edgeColor = JeditFrame.DEFAULT_EDGE_COLOR
marked = false


Edge

protected Edge(Edge source)
Cloning constructor. Copies the Edge attributes of source to a new Edge.

Parameters:
source - the edge to clone
Method Detail

mark

protected void mark()
Marks the Edge by setting an internal attribute marked to true and by setting the attribute edgeColor to JeditFrame.DEFAULT_MARKED_COLOR.


unmark

protected void unmark()
Unmarks the Edge by setting an internal attribute marked to false and by setting the attribute edgeColor to JeditFrame.DEFAULT_EDGE_COLOR.


isMarked

protected boolean isMarked()
Returns true if Edge is marked.

Returns:
boolean

getColor

protected Color getColor()
Returns the color of the Edge.

Returns:
Color

setColor

protected void setColor(Color newColor)
Sets the color of the Edge to be the value of newColor.

Parameters:
newColor - the color to change the edge to

getWeight2

protected double getWeight2()
Returns the value of weight2 of the Edge.

Returns:
double

getWeight

protected double getWeight()
Returns the value of weight of the Edge.

Returns:
double

getLabel

protected String getLabel()
Returns the string label of the Edge.

Returns:
String

setWeight

protected void setWeight(double newWeight)
Sets the value of weight of the Edge to be newWeight.

Parameters:
newWeight - the value to set weight of the edge to

setWeight2

protected void setWeight2(double newWeight)
Sets the value of weight2 of the Edge to be newWeight.

Parameters:
newWeight - the value to set weight2 of the edge to

setLabel

protected void setLabel(String newLabel)
Sets the value of the label of the edge to be newLabel.

Parameters:
newLabel - the value to set the edge label to

toString

public String toString()
Returns a string in the form of [label]:[weight].

Overrides:
toString in class Object
Returns:
String

Jedit 4.1