graph
Class Face

java.lang.Object
  |
  +--graph.Face

public class Face
extends java.lang.Object

Each Face object has two properties: 1. the vertices around the polygon, in cyclic order. 2. a boolean attribute isFinal, telling whether the face can be further modified or not. The attribute final is used in a way that is analogous to, but not identical to, the usage in the Java language. A final face is one that cannot undergo faceDivision. Every graph is immutable by construction, except in its isFinal attribute, but even an immutable graph is not final, if it has a face that is not final. A final graph is one that should be considered as a candidate for a counterexample to the Kepler conjecture. A non final graph is one that should be used to construct additional graphs. A face that is not final is one on which new graphs can be constructed, by adding additional faces. A face is immutable except that the isFinal attribute can be changed through the setFinal method.


Inner Class Summary
static class Face.Test
          Unit testing of Face
 
Method Summary
 int directedLength(Vertex v1, Vertex v2)
          The number of edges along this Face from v1 to v2, moving in clockwise direction.
 Vertex getAny()
          getAny returns any vertex of the face.
 boolean isFinal()
          A final Face is one that cannot be used to construct new graphs.
 Vertex next(Vertex v, int count)
          Find the count'th successor to vertex v in the cyclic order around the face.
 void setFinal(boolean b)
          setFinal is the only method that violates the immutability of the graph.
 int size()
          The size of a face is the number of vertices that it has.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

size

public int size()
The size of a face is the number of vertices that it has.

isFinal

public boolean isFinal()
A final Face is one that cannot be used to construct new graphs.

setFinal

public void setFinal(boolean b)
setFinal is the only method that violates the immutability of the graph. It is not possible to make the attribute isFinal false.
Parameters:
b - boolean state to set isFinal to.

next

public Vertex next(Vertex v,
                   int count)
Find the count'th successor to vertex v in the cyclic order around the face. If the Vertex v does not appear on the Face, returns null.

Examples: next(v,0) = v; next(v,size())=v; next(v,1) = successor in a clockwise direction.

Face.next moves clockwise around the face, but Vertex.next moves counterclockwise. This means that if faces R and S share an edge E with terminal vertices x and y, and if y occurs clockwise around R from x, then S=x.next(R,1); R=y.next(S,1); x=S.next(y,1); y=R.next(x,1); See graphDoc.gif

Parameters:
v - the Vertex used as a base point along the Face. If v does not appear on the Face, return null.
count - this many vertices past v to locate the Vertex returned. The return value only depends on count mod this.size();


getAny

public Vertex getAny()
getAny returns any vertex of the face. This, together with repeated calls to "next" will give an enumeration of all vertices.

In the unlikely event that the Face has no vertices, a null is returned;


directedLength

public int directedLength(Vertex v1,
                          Vertex v2)
The number of edges along this Face from v1 to v2, moving in clockwise direction.

Invariant: If r=directedLength(v1,v2), then next(v1,r) equals v2;

Parameters:
v1 - The first vertex on this Face.
v2 - The second vertex on this Face.
Returns:
-1 if v1 or v2 is not on this Face, else a nonnegative integer.