Jedit 4.1

edu.bsu.cs.graph
Class Vertex

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

public class Vertex
extends Object
implements Serializable

The base class for implementing a graph vertex. A vertex consists of the following attributes: a string label, integer coordinates x and y, a vertexColor, a boolean marked, and a weight.

Since:
21 Nov 1997
Version:
21 Jun 2002
Author:
Aaron Nall
, Elizabeth VandenBerg
See Also:
Serializable, Serialized Form

Constructor Summary
protected Vertex()
          Default constructor.
protected Vertex(Vertex source)
          Cloning constructor.
 
Method Summary
protected  Color getColor()
          Returns the color of the Vertex.
protected  Point getCoord()
          Returns a point containing the x,y coordinates of the Vertex.
protected  String getLabel()
          Returns the string label of the Vertex.
protected  double getWeight()
          Returns the weight of the Vertex.
protected  boolean isMarked()
          Returns true if Vertex is marked.
protected  void mark()
          Marks the Vertex by setting an internal attribute marked to true and by setting the attribute vertexColor to JeditFrame.DEFAULT_MARKED_COLOR.
protected  void setColor(Color newColor)
          Sets the color of the Vertex to be the value of newColor.
protected  void setCoord(Point newPoint)
          Sets the x,y coordinates of the Vertex to be the value of the x,y coordinates in newPoint.
protected  void setLabel(String newString)
          Sets the string label of the Vertex to be the value of newString.
protected  void setWeight(double newWeight)
          Sets the weight of the Vertex to be the value of newWeight.
 String toString()
          Returns a string in the form of [label]([x],[y]) [weight].
protected  void unmark()
          Unmarks the Vertex by setting an internal attribute marked to false and by setting the attribute vertexColor to JeditFrame.DEFAULT_VERTEX_COLOR.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Vertex

protected Vertex()
Default constructor. Sets internal private values with the following defaults:
label = {blank string}
weight = 0.0
x = 0
y = 0
vertexColor = JeditFrame.DEFAULT_VERTEX_COLOR
marked = false


Vertex

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

Parameters:
source - the vertex to clone
Method Detail

mark

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


unmark

protected void unmark()
Unmarks the Vertex by setting an internal attribute marked to false and by setting the attribute vertexColor to JeditFrame.DEFAULT_VERTEX_COLOR.


isMarked

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

Returns:
boolean

getColor

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

Returns:
Color

setColor

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

Parameters:
newColor - the color to set the vertex to

getLabel

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

Returns:
String

setLabel

protected void setLabel(String newString)
Sets the string label of the Vertex to be the value of newString.

Parameters:
newString - the string to set the vertex label to

getWeight

protected double getWeight()
Returns the weight of the Vertex.

Returns:
double

setWeight

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

Parameters:
newWeight - the value to set the vertex weight to

setCoord

protected void setCoord(Point newPoint)
Sets the x,y coordinates of the Vertex to be the value of the x,y coordinates in newPoint.

Parameters:
newPoint - the new coordinates of the point

getCoord

protected Point getCoord()
Returns a point containing the x,y coordinates of the Vertex.

Returns:
Point

toString

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

Overrides:
toString in class Object
Returns:
String

Jedit 4.1