com.sun.electric.tool.routing
Class Route

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<RouteElement>
              extended by com.sun.electric.tool.routing.Route
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<RouteElement>, java.util.Collection<RouteElement>, java.util.List<RouteElement>, java.util.RandomAccess

public class Route
extends java.util.ArrayList<RouteElement>

Specifies a route to be created. Note that the order if items in a route is meaningless. The only thing that specifies order is the start and end of the route.

Author: gainsley

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
Route()
          Constructs an empty route
Route(java.util.Collection<RouteElement> c)
          Constructs a route containing the elements of the passed route, in the order they are returned by the route iterator, and having the same start and end RouteElement (if Collection is a Route).
 
Method Summary
 RouteElementPort getEnd()
          Get the end of the Route
 RouteElementPort getStart()
          Get the start of the Route
 boolean isRouteReversed()
          True if the route is reversed, false if it is not reversed
 boolean replaceBisectPin(RouteElementPort bisectPin, RouteElementPort replacement)
          Attempts to replace the bisectPin by replacement.
 boolean replaceExistingRedundantPin(RouteElementPort pinRE, RouteElementPort replacementRE, PolyMerge stayInside)
          Attempts to replace an existing pin that has been made redundant by some node in the route, such as a contact cut.
 boolean replacePin(RouteElementPort pin, RouteElementPort replacement, PolyMerge stayInside)
          Attempts to replace pin with replacement.
 void reverseRoute()
          Reverse the Route.
 void setEnd(RouteElementPort endRE)
          Sets the end of the Route
 void setStart(RouteElementPort startRE)
          Sets the start of the Route
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeRange, retainAll, set, size, subList, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode
 
Methods inherited from class java.util.AbstractCollection
containsAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode
 

Constructor Detail

Route

public Route()
Constructs an empty route


Route

public Route(java.util.Collection<RouteElement> c)
Constructs a route containing the elements of the passed route, in the order they are returned by the route iterator, and having the same start and end RouteElement (if Collection is a Route).

Method Detail

setStart

public void setStart(RouteElementPort startRE)
Sets the start of the Route


getStart

public RouteElementPort getStart()
Get the start of the Route


setEnd

public void setEnd(RouteElementPort endRE)
Sets the end of the Route


getEnd

public RouteElementPort getEnd()
Get the end of the Route


reverseRoute

public void reverseRoute()
Reverse the Route. This just swaps and the start and end RouteElements, because the order of the list does not matter.


isRouteReversed

public boolean isRouteReversed()
True if the route is reversed, false if it is not reversed


replacePin

public boolean replacePin(RouteElementPort pin,
                          RouteElementPort replacement,
                          PolyMerge stayInside)
Attempts to replace pin with replacement. See replaceBisectPin and replaceExistingRedundantPin for details.

Parameters:
pin - the pin to replace
replacement - the replacement
stayInside - a polygonal area in which the new arc must reside (if not null).
Returns:
true if any replacement done, false otherwise.

replaceBisectPin

public boolean replaceBisectPin(RouteElementPort bisectPin,
                                RouteElementPort replacement)
Attempts to replace the bisectPin by replacement. Returns true if any replacements done, and bisect pin is no longer used. otherwise returns false. This method currently requires both bisectPin and replacement to be part of this Route when this method is called.

Parameters:
bisectPin - the port pin to replace
replacement - the port pin to replace bisectPin with.
Returns:
true if any replacements done and bisectPin no longer used, false otherwise.

replaceExistingRedundantPin

public boolean replaceExistingRedundantPin(RouteElementPort pinRE,
                                           RouteElementPort replacementRE,
                                           PolyMerge stayInside)
Attempts to replace an existing pin that has been made redundant by some node in the route, such as a contact cut. If replacable, all arcs that used to connect to the pin will connect to the replacement node. Note that this does not remove pinRE from the route, nor does it add replacementRE.

Parameters:
pinRE - the pin to replace
replacementRE - the replacement
stayInside - a polygonal area in which the new arc must reside (if not null).
Returns:
true if replacement done, false otherwise.