JavaGenes, NASA Ames. Written largely by Al Globus

gov.nasa.javaGenes.graph
Class Vertex

java.lang.Object
  extended bygov.nasa.alsUtility.Mark
      extended bygov.nasa.javaGenes.graph.GraphElement
          extended bygov.nasa.javaGenes.graph.Vertex
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
Atom, DirectedVertex

public class Vertex
extends GraphElement

a vertex in a graph. A vertex may have any number of edges connected to it.

See Also:
Graph, Edge, Serialized Form

Field Summary
protected  ExtendedVector edges
           
protected  java.lang.String extendedTypeCache
           
protected  int number
          used to number vertices for various purposes
protected  double[] xyz
           
 
Constructor Summary
Vertex()
           
 
Method Summary
 void add(Edge edge)
           
 boolean canAcceptEdge()
           
 boolean canAcceptEdge(Edge e)
           
 boolean canAcceptEdgesOf(Vertex v)
           
 java.lang.Object clone()
          don't make copies of the edges
 double getAngleBetween(Vertex v1, Vertex v2)
           
 double getDistanceTo(Vertex v)
           
 Edge getEdge(int i)
           
 EdgeIterator getEdgeIterator()
           
 java.lang.Object getExtendedTypeObject()
           
 java.lang.String getExtendedTypeString()
           
 Vector3d getLocationVector()
           
 int getNumber()
           
 java.lang.String getTypeString()
           
 double[] getXyz()
          get the physical location of the vertex
 boolean hasEdgeTo(Vertex v)
           
 boolean isSame(Vertex v)
           
 void moveInsideInterval(int dimension, double low, double high)
           
 void removeEdge(Edge edge)
           
 void scaleBy(double factor)
           
 void setNumber(int n)
           
 void setXyz(double[] replace)
          set the physical location of the vertex
 void setXyz(double x, double y, double z)
          set the physical location of the vertex
 Vertex shallowCopyVertex()
          don't make copies of the edges
 void stateChange()
          deletes cached information.
 void stealEdges(Vertex v)
           
 java.lang.String toString()
           
 void translate(Vector3d translation)
           
 void walkAll(Procedure vertexProcedure, Procedure edgeProcedure)
          assumes that only already walked vertices and edges are marked true
 void walkVertices(Procedure p)
          assumes that only already walked vertices are marked true
 
Methods inherited from class gov.nasa.alsUtility.Mark
getMark, isMarked, setMark
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

edges

protected ExtendedVector edges

xyz

protected double[] xyz

extendedTypeCache

protected java.lang.String extendedTypeCache

number

protected int number
used to number vertices for various purposes

Constructor Detail

Vertex

public Vertex()
Method Detail

stateChange

public void stateChange()
deletes cached information. Call when the vertex changes state.


shallowCopyVertex

public Vertex shallowCopyVertex()
don't make copies of the edges


clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
don't make copies of the edges

Throws:
java.lang.CloneNotSupportedException

isSame

public boolean isSame(Vertex v)

translate

public void translate(Vector3d translation)

getLocationVector

public Vector3d getLocationVector()

walkVertices

public void walkVertices(Procedure p)
assumes that only already walked vertices are marked true

See Also:
Mark

walkAll

public void walkAll(Procedure vertexProcedure,
                    Procedure edgeProcedure)
assumes that only already walked vertices and edges are marked true

See Also:
Mark

hasEdgeTo

public boolean hasEdgeTo(Vertex v)
Returns:
true if an edge connects this an v

getExtendedTypeString

public java.lang.String getExtendedTypeString()
Returns:
a string suitable as a hashtable key for the extended type of this vertex. The extended type is the type of the vertex (usually found in a subclass) and the types of all incident edges. The return value is cached for future use without recalculation.

getExtendedTypeObject

public java.lang.Object getExtendedTypeObject()
Returns:
an object suitable as a hashtable key for the extended type of this vertex. The extended type is the type of the vertex (usually found in a subclass) and the types of all incident edges. Not currently implemented. Atom does implement this.
See Also:
Atom

getEdge

public Edge getEdge(int i)

add

public void add(Edge edge)

removeEdge

public void removeEdge(Edge edge)

stealEdges

public void stealEdges(Vertex v)

canAcceptEdgesOf

public boolean canAcceptEdgesOf(Vertex v)

getEdgeIterator

public EdgeIterator getEdgeIterator()

canAcceptEdge

public boolean canAcceptEdge()
Returns:
true if another edge can be added

canAcceptEdge

public boolean canAcceptEdge(Edge e)
Returns:
true. Subclasses should return true if Edge e can be added

getTypeString

public java.lang.String getTypeString()

toString

public java.lang.String toString()

getNumber

public int getNumber()
Returns:
number

setNumber

public void setNumber(int n)

getXyz

public double[] getXyz()
get the physical location of the vertex

Returns:
an array of length 3

scaleBy

public void scaleBy(double factor)

moveInsideInterval

public void moveInsideInterval(int dimension,
                               double low,
                               double high)

setXyz

public void setXyz(double[] replace)
set the physical location of the vertex

Parameters:
replace - an array of length 3

setXyz

public void setXyz(double x,
                   double y,
                   double z)
set the physical location of the vertex


getDistanceTo

public double getDistanceTo(Vertex v)
Returns:
the Euclidian distance to v

getAngleBetween

public double getAngleBetween(Vertex v1,
                              Vertex v2)

JavaGenes, NASA Ames. Written largely by Al Globus