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
-
anotherStartColor
-
-
color
- Status of this vertex.
-
defaultColor
- Default colors of the vertex.
-
distance
- Distance to this Vertex.
-
endColor
-
-
hopDist
- Hop distance
-
identity
- identity of this Vertex.
-
inDegree
- In-degree of this vertex.
-
NUL
- Indicate null item
-
outDegree
- Out-degree of this vertex.
-
predecessorNode
- ID of predecessor.
-
startColor
-
-
x
- coordinate x of this Vertex.
-
y
- coordinate y of this Vertex.
-
Vertex()
- Constructs a dummy vertex.
-
Vertex(int, int, int)
- Constructs a vertex with specified identity.
-
Vertex(int, int, int, Color)
- Constructs a vertex with specified identity and color.
-
clean()
- Clean all special attribute.
-
clone()
- Returns a deep-copied clone of this Vertex.
-
compareTo(Object)
- Compare the distance with specified vertex.
-
copyFrom(Vertex)
- Copies the components from specified Vertex to this Vertex
-
getColor()
- Get the color of vertex.
-
getDistance()
- Get the distance of vertex.
-
getHopDist()
- Get the hop distance of vertex.
-
getID()
- Get the identity of vertex.
-
getInDegree()
- Get the in-degree of vertex.
-
getOutDegree()
- Get the out-degree of vertex.
-
getPredecessorNode()
- Get the identity of predecessor of vertex.
-
getX()
- Get the coordinate x of vertex.
-
getY()
- Get the coordinate y of vertex.
-
increaseInDegree(int)
- Increase in-degree
-
increaseOutDegree(int)
- Increase out-degree
-
reset()
- Reset visited, touched and color attribute.
-
setColor(Color)
- Set the color of vertex.
-
setDistance(double)
- Set the distance of vertex.
-
setHopDist(int)
- Set the hop distance of vertex.
-
setInDegree(int)
- Set the in-degree of vertex.
-
setOutDegree(int)
- Set the out-degree of vertex.
-
setPredecessorNode(int)
- Set the identity of predecessor of vertex.
-
setX(int)
- Set the coordinate x of vertex.
-
setY(int)
- Set the coordinate y of vertex.
NUL
public static final int NUL
- Indicate null item
x
protected int x
- coordinate x of this Vertex.
y
protected int y
- coordinate y of this Vertex.
identity
protected int identity
- identity of this Vertex.
color
protected Color color
- Status of this vertex. Use color-represention.
predecessorNode
protected int predecessorNode
- ID of predecessor.
hopDist
protected int hopDist
- Hop distance
inDegree
protected int inDegree
- In-degree of this vertex.
outDegree
protected int outDegree
- Out-degree of this vertex.
distance
protected double distance
- Distance to this Vertex.
defaultColor
public static Color defaultColor
- Default colors of the vertex.
startColor
public static Color startColor
anotherStartColor
public static Color anotherStartColor
endColor
public static Color endColor
Vertex
public Vertex()
- Constructs a dummy vertex.
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
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
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
copyFrom
public void copyFrom(Vertex src)
- Copies the components from specified Vertex to this Vertex
- Parameters:
- src - the source Vertex
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
reset
public void reset()
- Reset visited, touched and color attribute.
Reset the following attribute:
color=defaultColor;
- See Also:
- clear
getID
public int getID()
- Get the identity of vertex.
- Returns:
- the idenity of vertex.
getX
public int getX()
- Get the coordinate x of vertex.
- Returns:
- the coordinate x of vertex.
setX
protected void setX(int x)
- Set the coordinate x of vertex.
- Parameters:
- x - the coordinate x of vertex.
getY
public int getY()
- Get the coordinate y of vertex.
- Returns:
- the coordinate y of vertex.
setY
protected void setY(int y)
- Set the coordinate y of vertex.
- Parameters:
- y - the coordinate y of vertex.
getPredecessorNode
public int getPredecessorNode()
- Get the identity of predecessor of vertex.
- Returns:
- the identity of predecessor of vertex.
setPredecessorNode
public void setPredecessorNode(int predecessorNode)
- Set the identity of predecessor of vertex.
- Parameters:
- predecessorNode - identity of predecessor of vertex.
getHopDist
public int getHopDist()
- Get the hop distance of vertex.
- Returns:
- the hop distance of vertex.
setHopDist
public void setHopDist(int hopDist)
- Set the hop distance of vertex.
- Parameters:
- hopDist - the hop distance of vertex.
getColor
public Color getColor()
- Get the color of vertex.
- Returns:
- the color of vertex.
setColor
public void setColor(Color color)
- Set the color of vertex.
- Parameters:
- color - the hop distance of vertex.
getInDegree
public int getInDegree()
- Get the in-degree of vertex.
- Returns:
- the in-degree of vertex.
setInDegree
protected void setInDegree(int inDegree)
- Set the in-degree of vertex.
- Parameters:
- inDegree - the in-degree of vertex.
increaseInDegree
protected int increaseInDegree(int i)
- Increase in-degree
- Parameters:
- i - add i to in-degree of this vertex
- Returns:
- the result of addition.
getOutDegree
public int getOutDegree()
- Get the out-degree of vertex.
- Returns:
- the out-degree of vertex.
setOutDegree
protected void setOutDegree(int outDegree)
- Set the out-degree of vertex.
- Parameters:
- outDegree - the out-degree of vertex.
increaseOutDegree
protected int increaseOutDegree(int i)
- Increase out-degree
- Parameters:
- i - add i to out-degree of this vertex
- Returns:
- the result of addition.
getDistance
public double getDistance()
- Get the distance of vertex.
- Returns:
- the distance of vertex.
setDistance
public void setDistance(double distance)
- Set the distance of vertex.
- Parameters:
- distance - the distance of vertex.
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