public class Edge extends Object
Constructor and Description |
---|
Edge(int id1,
int id2)
Constructs an edge between two nodes.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
int |
getId1()
Returns the identifier of the first node.
|
int |
getId2()
Returns the identifier of the second node.
|
int |
getOppositeEndpoint(int id)
Returns the opposite endpoint of this edge.
|
boolean |
hasEndpoint(int id)
Returns
true if either endpoint of this edge is the specified
node; false otherwise. |
int |
hashCode() |
String |
toString() |
public Edge(int id1, int id2)
id1
- the identifier of the first nodeid2
- the identifier of the second nodepublic int getId1()
public int getId2()
public boolean hasEndpoint(int id)
true
if either endpoint of this edge is the specified
node; false
otherwise.id
- the identifier of the nodetrue
if either endpoint of this edge is the specified
node; false
otherwispublic int getOppositeEndpoint(int id)
id
- the identifier of the one endpointIllegalArgumentException
- if this edge does not have the any
endpoint with the specified identifierCopyright © 2016. All rights reserved.