import java.awt.*;
import java.awt.geom.*;
/**
* The super class of all network nodes.
*
* @author Eric Lemar
*/
public abstract class NetworkNode implements Node
{
/** The upper left hand corner */
protected double x;
/** The upper left hand corner */
protected double y;
public NetworkNode()
{
x = 0;
y = 0;
}
/**
* Tell this node that it is being removed.
*
* The provided implementaion is a no-op.
*
* @param e The edge that is being removed.
*/
public void signalRemove(NetworkEdge e) {
return;
}
public Object clone()
{
try {
return super.clone();
} catch (CloneNotSupportedException cne) {
return null;
}
}
public void translate(double dx, double dy) {
x += dx;
y += dy;
}
/**
* Ask whether it's ok to add an edge to another node.
*
* The provided implementation always returns true
.
*
* @param e The edge being added
* @param otherNode the node on the other side of the edge
* @return true
if ok, false
otherwise.
*/
public boolean isOkConnect(NetworkEdge e,NetworkNode otherNode) {
return true;
}
/**
* Tell this node that an edge was added.
*
* The provided implementation is a noop.
*
* @param e The edge added.
* @param otherNode The node on the other end.
*/
public void addedEdge(NetworkEdge e,NetworkNode otherNode) {
return;
}
}