public class Edge
extends java.lang.Object
Constructor and Description |
---|
Edge(Node n1,
Node n2)
Creates an undirected edge between the given nodes.
|
Edge(Node n1,
Node n2,
boolean isDirected)
Creates a possibly directed edge between the given nodes.
|
Modifier and Type | Method and Description |
---|---|
void |
draw(processing.core.PApplet applet,
float p1x,
float p1y,
float p2x,
float p2y)
Allows the edge to be drawn in the given Processing applet.
|
Node |
getNode1()
Reports the first node connected to this edge
|
Node |
getNode2()
Reports the second node connected to this edge
|
boolean |
isDirected()
Reports whether or not this edge is directed.
|
public Edge(Node n1, Node n2)
n1
- First node in the edge.n2
- Second node in the edge.public Edge(Node n1, Node n2, boolean isDirected)
n1
- First node in the edge.n2
- Second node in the edge.isDirected
- If true the edge runs from n1 to n2 but not the other way. If false,
the edge represents an undirected connection between the two nodes.public void draw(processing.core.PApplet applet, float p1x, float p1y, float p2x, float p2y)
applet
- Processing sketch in which to draw this edge.p1x
- x-coordinate of the first node in the edge.p1y
- y-coordinate of the first node in the edge.p2x
- x-coordinate of the second node in the edge.p2y
- y-coordinate of the second node in the edge.public Node getNode1()
public Node getNode2()
public boolean isDirected()