scg.ac.ni.pmf.newgraph.graphdata
Class VertexData

java.lang.Object
  extended by scg.ac.ni.pmf.newgraph.graphdata.VertexData
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable, ElementData

public final class VertexData
extends java.lang.Object
implements ElementData, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable

Represents the data which defines a vertex. It has the ID of the vertex and the coordinates. It also implements the basic methods for manipulating vertices as the data structure, such as hash tables and sorting algorithms.

The class can only report info about the vertex, it can not change it. For changing the vertex, the class Vertex is used.

Author:
Vladimir Brankov
See Also:
Vertex, Graph, Serialized Form

Method Summary
 java.lang.Object clone()
          Clones the vertex.
 int compareTo(java.lang.Object o)
          Compares the object.
 java.util.Set component()
          Retrieves the component that the vertex belongs to.
 int degree()
          Retrieves the degree of the vertex.
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is equal to this one.
 int getID()
          Retrieves the identification number (ID) of the vertex.
 java.util.Set getIncident()
          Retrieves the set of edges incident with the specified vertex.
 java.util.Enumeration getNeighbors()
          Retrieves an enumeration of neighbors of the specified vertex.
 float getX()
          Retrieves the horizontal coordinate (X) of the vertex on the graphical representation of the graph.
 float getY()
          Retrieves the vertical coordinate (Y) of the vertex on the graphical representation of the graph.
 int hashCode()
          Returns a hash code value for the object.
 boolean isAdjanced(VertexData v)
          Retrieves is the vertex adjanced to the specified vertex.
 boolean isIncident(EdgeData e)
          Retrieves is the vertex incident with the specified edge.
 boolean isPrimarySelected()
          Retrieves is the vertex primary selected.
 boolean isSelected()
          Retrieves is the vertex selected.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is equal to this one.

Overrides:
equals in class java.lang.Object
See Also:
Object.equals(Object)

hashCode

public int hashCode()
Returns a hash code value for the object.

Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clones the vertex.

Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException
See Also:
Object.clone()

compareTo

public int compareTo(java.lang.Object o)
Compares the object.

Specified by:
compareTo in interface java.lang.Comparable
See Also:
Comparable.compareTo(Object)

getID

public int getID()
Retrieves the identification number (ID) of the vertex. The ID is unique for each vertex of the graph.

Returns:
int The ID.

getX

public float getX()
Retrieves the horizontal coordinate (X) of the vertex on the graphical representation of the graph.

Returns:
float The X coordinate.

getY

public float getY()
Retrieves the vertical coordinate (Y) of the vertex on the graphical representation of the graph.

Returns:
float The Y coordinate.

isAdjanced

public boolean isAdjanced(VertexData v)
Retrieves is the vertex adjanced to the specified vertex.

Parameters:
v - The vertex.
Returns:
boolean Indicates is the vertex adjanced to the specified vertex.

isIncident

public boolean isIncident(EdgeData e)
Retrieves is the vertex incident with the specified edge.

Parameters:
e - The edge.
Returns:
boolean Indicates is the vertex incident to the specified edge.

isSelected

public boolean isSelected()
Retrieves is the vertex selected.

Specified by:
isSelected in interface ElementData
Returns:
boolean Indicates whether the vertex is selected.

isPrimarySelected

public boolean isPrimarySelected()
Retrieves is the vertex primary selected.

Returns:
boolean Indicates whether the vertex is primary selected.

getNeighbors

public java.util.Enumeration getNeighbors()
Retrieves an enumeration of neighbors of the specified vertex.

Returns:
Enumeration An enumeration of VertexData.

getIncident

public java.util.Set getIncident()
Retrieves the set of edges incident with the specified vertex. If the vertex does not exist, returns null.

Returns:
Collection A collection of EdgeData.

degree

public int degree()
Retrieves the degree of the vertex.

Returns:
int The degree.

component

public java.util.Set component()
Retrieves the component that the vertex belongs to.

Returns:
Set The set of VertexData.


Copyright © 2004 Dragan Stevanovic, Vladimir Brankov.