All Packages  Class Hierarchy  This Package  Previous  Next  Index

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

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

public class Vertex
extends Object
implements Cloneable, Serializable, Comparable11
The Vertex class implements data structure of vertex of graphs.

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

Variable Index

 o anotherStartColor
 o color
Status of this vertex.
 o defaultColor
Default colors of the vertex.
 o distance
Distance to this Vertex.
 o endColor
 o hopDist
Hop distance
 o identity
identity of this Vertex.
 o inDegree
In-degree of this vertex.
 o NUL
Indicate null item
 o outDegree
Out-degree of this vertex.
 o predecessorNode
ID of predecessor.
 o startColor
 o x
coordinate x of this Vertex.
 o y
coordinate y of this Vertex.

Constructor Index

 o Vertex()
Constructs a dummy vertex.
 o Vertex(int, int, int)
Constructs a vertex with specified identity.
 o Vertex(int, int, int, Color)
Constructs a vertex with specified identity and color.

Method Index

 o clean()
Clean all special attribute.
 o clone()
Returns a deep-copied clone of this Vertex.
 o compareTo(Object)
Compare the distance with specified vertex.
 o copyFrom(Vertex)
Copies the components from specified Vertex to this Vertex
 o getColor()
Get the color of vertex.
 o getDistance()
Get the distance of vertex.
 o getHopDist()
Get the hop distance of vertex.
 o getID()
Get the identity of vertex.
 o getInDegree()
Get the in-degree of vertex.
 o getOutDegree()
Get the out-degree of vertex.
 o getPredecessorNode()
Get the identity of predecessor of vertex.
 o getX()
Get the coordinate x of vertex.
 o getY()
Get the coordinate y of vertex.
 o increaseInDegree(int)
Increase in-degree
 o increaseOutDegree(int)
Increase out-degree
 o reset()
Reset visited, touched and color attribute.
 o setColor(Color)
Set the color of vertex.
 o setDistance(double)
Set the distance of vertex.
 o setHopDist(int)
Set the hop distance of vertex.
 o setInDegree(int)
Set the in-degree of vertex.
 o setOutDegree(int)
Set the out-degree of vertex.
 o setPredecessorNode(int)
Set the identity of predecessor of vertex.
 o setX(int)
Set the coordinate x of vertex.
 o setY(int)
Set the coordinate y of vertex.

Variables

 o NUL
 public static final int NUL
Indicate null item

 o x
 protected int x
coordinate x of this Vertex.

 o y
 protected int y
coordinate y of this Vertex.

 o identity
 protected int identity
identity of this Vertex.

 o color
 protected Color color
Status of this vertex. Use color-represention.

 o predecessorNode
 protected int predecessorNode
ID of predecessor.

 o hopDist
 protected int hopDist
Hop distance

 o inDegree
 protected int inDegree
In-degree of this vertex.

 o outDegree
 protected int outDegree
Out-degree of this vertex.

 o distance
 protected double distance
Distance to this Vertex.

 o defaultColor
 public static Color defaultColor
Default colors of the vertex.

 o startColor
 public static Color startColor
 o anotherStartColor
 public static Color anotherStartColor
 o endColor
 public static Color endColor

Constructors

 o Vertex
 public Vertex()
Constructs a dummy vertex.

 o Vertex
 public Vertex(int identity,
               int x,
               int y)
Constructs a vertex with specified identity.

Parameters:
identity - the identity of this vertex
x - the coordinate x of this vertex
y - the coordinate y of this vertex
 o Vertex
 public Vertex(int identity,
               int x,
               int y,
               Color color)
Constructs a vertex with specified identity and color.

Parameters:
identity - the identity of this vertex
x - the coordinate x of this vertex
y - the coordinate y of this vertex
color - the color of this vertex

Methods

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

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

   predecessorNode=NUL;
   hopDist=NUL;
   distance=Double.POSITIVE_INFINITY;
   

See Also:
reset
 o copyFrom
 public void copyFrom(Vertex src)
Copies the components from specified Vertex to this Vertex

Parameters:
src - the source Vertex
 o clone
 public Object clone()
Returns a deep-copied clone of this Vertex.

Returns:
a deep-copied clone of this Vertex.
Overrides:
clone in class Object
 o reset
 public void reset()
Reset visited, touched and color attribute.

Reset the following attribute:

   color=defaultColor;
   

See Also:
clear
 o getID
 public int getID()
Get the identity of vertex.

Returns:
the idenity of vertex.
 o getX
 public int getX()
Get the coordinate x of vertex.

Returns:
the coordinate x of vertex.
 o setX
 protected void setX(int x)
Set the coordinate x of vertex.

Parameters:
x - the coordinate x of vertex.
 o getY
 public int getY()
Get the coordinate y of vertex.

Returns:
the coordinate y of vertex.
 o setY
 protected void setY(int y)
Set the coordinate y of vertex.

Parameters:
y - the coordinate y of vertex.
 o getPredecessorNode
 public int getPredecessorNode()
Get the identity of predecessor of vertex.

Returns:
the identity of predecessor of vertex.
 o setPredecessorNode
 public void setPredecessorNode(int predecessorNode)
Set the identity of predecessor of vertex.

Parameters:
predecessorNode - identity of predecessor of vertex.
 o getHopDist
 public int getHopDist()
Get the hop distance of vertex.

Returns:
the hop distance of vertex.
 o setHopDist
 public void setHopDist(int hopDist)
Set the hop distance of vertex.

Parameters:
hopDist - the hop distance of vertex.
 o getColor
 public Color getColor()
Get the color of vertex.

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

Parameters:
color - the hop distance of vertex.
 o getInDegree
 public int getInDegree()
Get the in-degree of vertex.

Returns:
the in-degree of vertex.
 o setInDegree
 protected void setInDegree(int inDegree)
Set the in-degree of vertex.

Parameters:
inDegree - the in-degree of vertex.
 o increaseInDegree
 protected int increaseInDegree(int i)
Increase in-degree

Parameters:
i - add i to in-degree of this vertex
Returns:
the result of addition.
 o getOutDegree
 public int getOutDegree()
Get the out-degree of vertex.

Returns:
the out-degree of vertex.
 o setOutDegree
 protected void setOutDegree(int outDegree)
Set the out-degree of vertex.

Parameters:
outDegree - the out-degree of vertex.
 o increaseOutDegree
 protected int increaseOutDegree(int i)
Increase out-degree

Parameters:
i - add i to out-degree of this vertex
Returns:
the result of addition.
 o getDistance
 public double getDistance()
Get the distance of vertex.

Returns:
the distance of vertex.
 o setDistance
 public void setDistance(double distance)
Set the distance of vertex.

Parameters:
distance - the distance of vertex.
 o compareTo
 public int compareTo(Object rhs) throws ClassCastException
Compare the distance with specified vertex.

Parameters:
rhs - the second vertex
Returns:
0 if two objects are equal;
-1 if this object is smaller;
1 if this object is larger.
Throws: ClassCastException
the specified Object's type prevents it from being compared to this Object.

All Packages  Class Hierarchy  This Package  Previous  Next  Index