Class Cycle

  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.ArrayList
              extended byorg.geotools.graph.path.Walk
                  extended byorg.geotools.graph.path.Cycle
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.List, NodeSequence, java.util.RandomAccess,

public class Cycle
extends Walk

Represents a cycle in a graph. A cycle C is defined as a closed walk of size n in which nodes 1 through n-1 form a path.

Justin Deoliveira, Refractions Research Inc,
See Also:
Serialized Form

Field Summary
Fields inherited from class java.util.AbstractList
Constructor Summary
Cycle(java.util.Collection nodes)
Method Summary
protected  java.util.List buildEdges()
          Internal method for building the edge set of the walk.
 boolean isValid()
          Tests if the cycle is valid.
Methods inherited from class org.geotools.graph.path.Walk
add, add, add, addAll, addAll, addEdge, addEdges, duplicate, equals, equals, getEdges, getFirst, getLast, hashCode, isClosed, remove, remove, remove, removeAll, reverse, riterator, truncate
Methods inherited from class java.util.ArrayList
clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, removeRange, set, size, toArray, toArray, trimToSize
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator, subList
Methods inherited from class java.util.AbstractCollection
containsAll, retainAll, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.geotools.graph.path.NodeSequence
iterator, size
Methods inherited from interface java.util.List
containsAll, iterator, listIterator, listIterator, retainAll, subList

Constructor Detail


public Cycle(java.util.Collection nodes)
Method Detail


public boolean isValid()
Tests if the cycle is valid. A valid cycle satisfies two conditions:

1. Each pair of adjacent nodes share an edge.
2. The first and last nodes share an edge. 3. The only node repetition is the first and last nodes.

Specified by:
isValid in interface NodeSequence
isValid in class Walk


protected java.util.List buildEdges()
Description copied from class: Walk
Internal method for building the edge set of the walk. This method calculated the edges upon every call.

buildEdges in class Walk
The list of edges for the walk, or null if the edge set could not be calculated due to an invalid walk.

Copyright © GeoTools. All Rights Reserved.