|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.hawaii.ics.yucheng.Edge
final class Edge
A undirected, non-cyclical edge. This class is immutable.
Field Summary | |
---|---|
private int |
myFirst
|
private int |
mySecond
|
Constructor Summary | |
---|---|
Edge(int first,
int second)
Initializes a new instance of the class. |
|
Edge(java.util.Scanner scanner)
Initializes a new instance of the class. |
Method Summary | |
---|---|
int |
compareTo(Edge o)
Compares this edge to another edge. |
boolean |
contains(int index)
Returns true if the edge contains a specified index. |
boolean |
equals(java.lang.Object obj)
Returns true if the object equals this instance. |
int |
first()
Returns the first index. |
int |
getOpposite(int index)
Returns the opposite index of the one specified. |
int |
hashCode()
Returns a hash code value for the object. |
int |
second()
Returns the second index. |
java.lang.String |
toString()
Returns the string representation of the class data. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private final int myFirst
private final int mySecond
Constructor Detail |
---|
public Edge(int first, int second)
first
- The first vertex.second
- The second vertex.public Edge(java.util.Scanner scanner) throws GraphException
scanner
- The scanner.
GraphException
- Thrown if there is an error reading from the
scanner.Method Detail |
---|
public int compareTo(Edge o)
compareTo
in interface java.lang.Comparable<Edge>
o
- The other edge.
public boolean contains(int index)
index
- The index.
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- The object to compare.
public int first()
public int getOpposite(int index)
index
- The index.
public int hashCode()
hashCode
in class java.lang.Object
public int second()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |