org.eclipse.draw2d

## Class AbstractRouter

- java.lang.Object
- - org.eclipse.draw2d.AbstractRouter

All Implemented Interfaces:
  ConnectionRouter

Direct Known Subclasses:
  AutomaticRouter, BendpointConnectionRouter, ConnectionRouter.NullConnectionRouter, ManhattanConnectionRouter, ShortestPathConnectionRouter

    public abstract class AbstractRouter
    extends java.lang.Object
    implements ConnectionRouter

Base class for implementing a connection router. This class provides stubs for constraint usage, and some utility methods.

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.eclipse.draw2d.ConnectionRouter

`ConnectionRouter.NullConnectionRouter`

### Field Summary

### Fields inherited from interface org.eclipse.draw2d.ConnectionRouter

`NULL`

### Constructor Summary

Constructors
Constructor and Description
`AbstractRouter()`

### Method Summary

Methods
`java.lang.Object` `getConstraint(Connection connection)` Returns the constraint for the given Connection.
`protected Point` `getEndPoint(Connection connection)` A convenience method for obtaining a connection's endpoint.
`protected Point` `getStartPoint(Connection conn)` A convenience method for obtaining a connection's start point.
`void` `invalidate(Connection connection)` Causes the router to discard any cached information about the given Connection.
`void` `remove(Connection connection)` Removes the given Connection from this routers list of Connections it is responsible for.
`void` `setConstraint(Connection connection, java.lang.Object constraint)` Sets the constraint for the given Connection.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.eclipse.draw2d.ConnectionRouter

`route`

### Constructor Detail

#### AbstractRouter

    public AbstractRouter()

### Method Detail

#### getConstraint

    public java.lang.Object getConstraint(Connection connection)

Returns the constraint for the given Connection.

Specified by:
  `getConstraint` in interface `ConnectionRouter`
Parameters:
  `connection` - The connection
Returns:
  The constraint
Since:
  2.0

#### getEndPoint

    protected Point getEndPoint(Connection connection)

A convenience method for obtaining a connection's endpoint. The connection's endpoint is a point in absolute coordinates obtained by using its source and target `ConnectionAnchor`. The returned Point is a static singleton that is reused to reduce garbage collection. The caller may modify this point in any way. However, the point will be reused and its values overwritten during the next call to this method.

Parameters:
  `connection` - The connection
Returns:
  The endpoint
Since:
  2.0

#### getStartPoint

    protected Point getStartPoint(Connection conn)

A convenience method for obtaining a connection's start point. The connection's startpoint is a point in absolute coordinates obtained by using its source and target `ConnectionAnchor`. The returned Point is a static singleton that is reused to reduce garbage collection. The caller may modify this point in any way. However, the point will be reused and its values overwritten during the next call to this method.

Parameters:
  `conn` - The connection
Returns:
  The start point
Since:
  2.0

#### invalidate

    public void invalidate(Connection connection)

Causes the router to discard any cached information about the given Connection.

Specified by:
  `invalidate` in interface `ConnectionRouter`
Parameters:
  `connection` - The connection to invalidate
Since:
  2.0

#### remove

    public void remove(Connection connection)

Removes the given Connection from this routers list of Connections it is responsible for.

Specified by:
  `remove` in interface `ConnectionRouter`
Parameters:
  `connection` - The connection to remove
Since:
  2.0

#### setConstraint

    public void setConstraint(Connection connection,
                     java.lang.Object constraint)

Sets the constraint for the given Connection.

Specified by:
  `setConstraint` in interface `ConnectionRouter`
Parameters:
  `connection` - The connection
  `constraint` - The constraint
Since:
  2.0