Class ColoringVertex

java.lang.Object
  |
  +--Vertex
        |
        +--ColoringVertex
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
GrundyColoringVertex, LFColoringVertex, TrivialColoringVertex

public abstract class ColoringVertex
extends Vertex
implements java.lang.Cloneable


Field Summary
protected  int color
           
protected static int MINCOLOR
           
 
Fields inherited from class Vertex
neighbors, xFactor, yFactor
 
Constructor Summary
ColoringVertex()
           
 
Method Summary
 boolean agree()
          This method should determine if vertex state agrees to rules of a specified algorithm
 java.lang.Object clone()
          This method works properly only with vertices without edges.
static int colorsUsed(Graph g)
          returns actual number of used colors in a whole graph g assuming that vertices extends ColoringVertex
 int getColor()
           
 int getState()
           
 java.lang.String getStateInfo()
          This method should get a state info of a vertex.
abstract  void move(int info)
          This method should make a move assuming that vertex is enabled.
 void paintState(java.awt.Graphics graphics)
          This method should paint a vertex according to its state, however in Vertex class it just paint circles with radius in red.
 void printState()
          This method should print a state of a vertex.
 void randomState(java.util.Random r)
          This method should random a state of a vertex.
 void setState(int i)
           
 
Methods inherited from class Vertex
addEdge, deg, distance, getInfo, getName, getRadius, getXCoordinate, getYCoordinate, iterator, print, setCoordinates, setFactors, setName, setRadius, setXCoordinate, setYCoordinate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

color

protected int color

MINCOLOR

protected static final int MINCOLOR
See Also:
Constant Field Values
Constructor Detail

ColoringVertex

public ColoringVertex()
Method Detail

move

public abstract void move(int info)
Description copied from class: Vertex
This method should make a move assuming that vertex is enabled.

Specified by:
move in class Vertex

getColor

public int getColor()

colorsUsed

public static int colorsUsed(Graph g)
returns actual number of used colors in a whole graph g assuming that vertices extends ColoringVertex


clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Description copied from class: Vertex
This method works properly only with vertices without edges. It is used when constructing a Graph

Overrides:
clone in class Vertex
java.lang.CloneNotSupportedException

agree

public boolean agree()
Description copied from class: Vertex
This method should determine if vertex state agrees to rules of a specified algorithm

Specified by:
agree in class Vertex
Returns:
true means that vertex agree, false other way vertex is available.

randomState

public void randomState(java.util.Random r)
Description copied from class: Vertex
This method should random a state of a vertex.

Specified by:
randomState in class Vertex

setState

public void setState(int i)

getState

public int getState()

printState

public void printState()
Description copied from class: Vertex
This method should print a state of a vertex.

Specified by:
printState in class Vertex

getStateInfo

public java.lang.String getStateInfo()
Description copied from class: Vertex
This method should get a state info of a vertex.

Specified by:
getStateInfo in class Vertex
Returns:
String describing a vertex state.
See Also:
VertexInfoDialog

paintState

public void paintState(java.awt.Graphics graphics)
Description copied from class: Vertex
This method should paint a vertex according to its state, however in Vertex class it just paint circles with radius in red. and should be rather overridden in subclasses.

Overrides:
paintState in class Vertex
See Also:
Vertex.setRadius(int), Graph.paintStates(java.awt.Graphics)