org.geotools.graph.path
Class Cycle
Object
AbstractCollection<E>
AbstractList<E>
ArrayList
Walk
Cycle
- All Implemented Interfaces:
- Serializable, Cloneable, Iterable, Collection, List, RandomAccess, NodeSequence
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.
- Author:
- Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net
- See Also:
- Serialized Form
- Module:
modules/extension/graph (gt-graph.jar)
Method Summary |
protected List |
buildEdges()
Internal method for building the edge set of the walk. |
boolean |
isValid()
Tests if the cycle is valid. |
Methods inherited from class 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 ArrayList |
clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, removeRange, set, size, toArray, toArray, trimToSize |
Cycle
public Cycle(Collection nodes)
isValid
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
- Overrides:
isValid
in class Walk
- Returns:
- True if valid, otherwise false.
buildEdges
protected 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.
- Overrides:
buildEdges
in class Walk
- Returns:
- The list of edges for the walk, or null if the edge set could
not be calculated due to an invalid walk.
Copyright © 1996-2010 Geotools. All Rights Reserved.