jlink.flowchart.graph
Class JLVertexSet

java.lang.Object
  extended by jlink.flowchart.graph.JLVertexSet

public class JLVertexSet
extends java.lang.Object

The complete set of vertices used in a JLGraph is modelled using this class. JLVertexSet is as its name suggests a set of vertices and methods to manipulate and search the set.

Author:
jasonkb

Field Summary
protected  java.util.LinkedList<JLVertex> vertexSet
          The internal model of the JLVertexSet is a linked list.
 
Constructor Summary
JLVertexSet()
          Creates a JLVertexSet with a blank inner linked list.
JLVertexSet(java.util.LinkedList<JLVertex> vertices)
          Creates a JLVertexSet with an externally provided linked list to copy another JLVertexSet
 
Method Summary
 void appendJLVertex(JLVertex v)
          Adds a JLVertex to this JLVertexSet.
 JLVertex getJLVertex(int vertexID)
          Get the JLVertex with matching unique vertex ID.
 int getJLVertexCount()
          Determine the number of JLVertex objects in the JLVertexSet.
 JLVertexSet getJLVertices(java.lang.String vertexName)
          Get all JLVertex objects in the JLVertexSet that have the corresponding vertex name.
 java.util.LinkedList<JLVertex> getLinkedList()
          Accessor method for the internal data model of JLVertexSet.
 void mirrorJLVertexSet(java.util.LinkedList<JLVertex> vertices)
          Copies the provided linked list to the JLVertexSet internally stored linked list to use as the data model.
 void removeJLVertex(int vertexID)
          Removes the JLVertex with the unique vertex ID that matches the parameter.
 void removeJLVertex(JLVertex v)
          Removes this JLVertex.
 void removeJLVertices(java.lang.String vertexName)
          Removes all JLVertex objects who have the matching vertex name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vertexSet

protected java.util.LinkedList<JLVertex> vertexSet
The internal model of the JLVertexSet is a linked list. While there are methods to manipulate this list directly, this is advised against as the class accessor methods are more meaningful and safer to use.

See Also:
mirrorJLVertexSet(LinkedList vertices), getLinkedList()
Constructor Detail

JLVertexSet

public JLVertexSet()
Creates a JLVertexSet with a blank inner linked list.

See Also:
vertexSet

JLVertexSet

public JLVertexSet(java.util.LinkedList<JLVertex> vertices)
Creates a JLVertexSet with an externally provided linked list to copy another JLVertexSet

Parameters:
vertices - The externally provided vertices to use.
Method Detail

mirrorJLVertexSet

public void mirrorJLVertexSet(java.util.LinkedList<JLVertex> vertices)
Copies the provided linked list to the JLVertexSet internally stored linked list to use as the data model. This can be used when trying to copy another JLGraph structure into a new JLGraph.

Parameters:
vertices - The linked list to model this JLVertexSet on.

getLinkedList

public java.util.LinkedList<JLVertex> getLinkedList()
Accessor method for the internal data model of JLVertexSet. While this is able to assist in directly manipulating the internal model, it is advised against. Use the API methods to safely manipulate this model. Use this method if you wish to get the model to copy to another JLGraph.

Returns:
The internal data model as a linked list.

appendJLVertex

public void appendJLVertex(JLVertex v)
                    throws DuplicateJLVertexException
Adds a JLVertex to this JLVertexSet.

Parameters:
v - The JLVertex to add.
Throws:
DuplicateJLVertexException - If there is a duplicate JLVertex.

removeJLVertex

public void removeJLVertex(JLVertex v)
Removes this JLVertex.

Parameters:
v - The JLVertex to remove.

removeJLVertex

public void removeJLVertex(int vertexID)
Removes the JLVertex with the unique vertex ID that matches the parameter.

Parameters:
vertexID - The unique vertex ID to remove the corresponding JLVertex.

removeJLVertices

public void removeJLVertices(java.lang.String vertexName)
Removes all JLVertex objects who have the matching vertex name.

Parameters:
vertexName - All JLVertex objects with this name will be removed.

getJLVertex

public JLVertex getJLVertex(int vertexID)
Get the JLVertex with matching unique vertex ID.

Parameters:
vertexID - The unique vertex ID.
Returns:
A JLVertex matching this ID else null if none were found.

getJLVertices

public JLVertexSet getJLVertices(java.lang.String vertexName)
Get all JLVertex objects in the JLVertexSet that have the corresponding vertex name.

Parameters:
vertexName - The vertex name to search against the JLVertex objects.
Returns:
A JLVertexSet with all matching JLVertex objects.

getJLVertexCount

public int getJLVertexCount()
Determine the number of JLVertex objects in the JLVertexSet.

Returns:
The total number of vertices in the set.