|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectedu.hawaii.ics.yucheng.GraphSolution
final class GraphSolution
A solution, or partial solution, for a graph. This class is immutable.
| Field Summary | |
|---|---|
private java.util.ArrayList<Edge> |
myEdges
|
private int |
myRoot
|
private float |
myWeight
|
static int |
NO_ROOT
|
static float |
NO_WEIGHT
|
| Constructor Summary | |
|---|---|
GraphSolution(java.util.Collection<Edge> edges)
Initializes a new instance of the class. |
|
GraphSolution(java.util.Collection<Edge> edges,
int root)
Initializes a new instance of the class. |
|
GraphSolution(java.util.Collection<Edge> edges,
int root,
float weight)
Initializes a new instance of the class. |
|
| Method Summary | |
|---|---|
boolean |
hasRoot()
Returns true if the solution has a root specified. |
boolean |
hasWeight()
Returns true if the solution has a weight specified. |
private static boolean |
isDuplicateEdge(java.util.Collection<Edge> edges,
Edge edge)
Returns true if the edge is a duplicate in a collection. |
java.util.Iterator<Edge> |
iterator()
Returns an iterator for the edges in the solution. |
int |
root()
Returns the root vertex. |
float |
weight()
Returns the calculated weight. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int NO_ROOT
public static final float NO_WEIGHT
private final java.util.ArrayList<Edge> myEdges
private final int myRoot
private final float myWeight
| Constructor Detail |
|---|
public GraphSolution(java.util.Collection<Edge> edges)
edges - The edges.
public GraphSolution(java.util.Collection<Edge> edges,
int root)
edges - The edges.root - The root edge.
public GraphSolution(java.util.Collection<Edge> edges,
int root,
float weight)
edges - The edges.root - The root edge.weight - The calculated weight.| Method Detail |
|---|
private static boolean isDuplicateEdge(java.util.Collection<Edge> edges,
Edge edge)
edges - The collection of edges.edge - The edge to find.
public boolean hasRoot()
public boolean hasWeight()
public java.util.Iterator<Edge> iterator()
iterator in interface java.lang.Iterable<Edge>public int root()
public float weight()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||