public abstract class AutomaticRouter extends AbstractRouter
handleCollision(PointList, int)
to determine how to avoid the
overlap.
This router can delegate to another connection router. The wrappered router will route the connections first, after which overlapping will be determined.
ConnectionRouter.NullConnectionRouter
NULL
Constructor and Description |
---|
AutomaticRouter() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getConstraint(Connection connection)
Returns the constraint for the given Connection.
|
protected abstract void |
handleCollision(PointList list,
int index)
Handles collisions between 2 or more Connections.
|
void |
invalidate(Connection conn)
Causes the router to discard any cached information about the given
Connection.
|
protected ConnectionRouter |
next()
Returns the next router in the chain.
|
void |
remove(Connection conn)
Removes the given Connection from this routers list of Connections it is
responsible for.
|
void |
route(Connection conn)
Routes the given connection.
|
void |
setConstraint(Connection connection,
java.lang.Object constraint)
An AutomaticRouter needs no constraints for the connections it routes.
|
protected void |
setEndPoints(Connection conn)
Sets the start and end points for the given connection.
|
void |
setNextRouter(ConnectionRouter router)
Sets the next router.
|
getEndPoint, getStartPoint
public java.lang.Object getConstraint(Connection connection)
AbstractRouter
getConstraint
in interface ConnectionRouter
getConstraint
in class AbstractRouter
connection
- The connectionConnectionRouter.getConstraint(Connection)
protected abstract void handleCollision(PointList list, int index)
list
- The PointList of a connection that collides with another
connectionindex
- The index of the current connection in the list of colliding
connectionspublic void invalidate(Connection conn)
AbstractRouter
invalidate
in interface ConnectionRouter
invalidate
in class AbstractRouter
conn
- The connection to invalidateConnectionRouter.invalidate(Connection)
protected ConnectionRouter next()
public void remove(Connection conn)
AbstractRouter
remove
in interface ConnectionRouter
remove
in class AbstractRouter
conn
- The connection to removeConnectionRouter.remove(Connection)
public void route(Connection conn)
handleCollision(PointList, int)
.conn
- The connection to routepublic void setConstraint(Connection connection, java.lang.Object constraint)
setConstraint(Connection, Object)
on the next()
router.setConstraint
in interface ConnectionRouter
setConstraint
in class AbstractRouter
connection
- The connectionconstraint
- The constraintConnectionRouter.setConstraint(Connection,
Object)
protected void setEndPoints(Connection conn)
conn
- The connectionpublic void setNextRouter(ConnectionRouter router)
router
- The ConnectionRouterCopyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.