jimmc.treepar
Class Net

java.lang.Object
  |
  +--jimmc.treepar.Net

public class Net
extends java.lang.Object

Net connects together the Connector objects from multiple Box objects.


Field Summary
protected  int angle
          The routing angle for this net.
protected  Connector[] connectors
          The connectors attached to this net.
protected  java.util.Vector connectorsVector
          The connectors attached to this net, as we build it.
protected  Layout layout
          Our layout.
static int LEFT
           
protected  int maxR
          The maximum R coordinate of the routing span.
protected  int minR
          The minimum R coordinate of the routing span.
protected  java.lang.String name
          Our name.
protected  boolean orderSet
          True when the row order has been set for this net.
protected  java.awt.Point[][] paths
          The points comprising our routing path.
static int RIGHT
           
protected  Row row
          The row containing this net.
protected  int rowNumber
          Our row number.
protected  boolean rowNumberSet
          True when rowNumber is set.
protected  int rowOrder
          The ordinal number of our position within our row.
protected  Track track
          The routing track to use for this net.
 
Constructor Summary
Net(Layout layout, java.lang.String name)
          Create a new net.
 
Method Summary
protected  void addConnector(Connector conn)
          Add a connector to this net.
protected  void addNetForce(Connector conn, int[] forcesums)
          Add in the force data from the specified connector to all other connectors on the net.
protected  void addToBounds(BoundsRectangle bounds)
          Increase the bounds if necessary to include the paths of this net.
protected  void calculateRoutingAngle()
          Calculate the routing angle of the net.
protected  void calculateSpan()
          Calculate the span of the net.
protected  void clearConnectors()
          Clear the connectors for the net.
protected  void clearRowNumber()
          Clear the row number.
protected  void clearRowOrder()
          Clear the row ordering for this net.
protected  void connectorsDone()
          Note all the connectors have been added.
protected  java.awt.Point[] createPath(int x0, int y0, int x1, int y1)
          Create a path with two points.
static void dump(java.io.PrintWriter f, Net[] nets, java.lang.String prefix, boolean details)
          Dump an array of nets.
 void dump(java.io.PrintWriter f, java.lang.String prefix, boolean details)
          Dump a net for debugging.
protected  boolean isRowOrderSet()
          Return true if the row order has already been set on this net.
protected  boolean needsTrackAssignment()
          Return true if we need to do a track assignment for this net.
protected  void paint(LayoutGraphics g)
          Draw all of the lines for this net.
protected  void route()
          Route the net.
protected  void setConnectorsRowOrder(int side, boolean negdir)
          Set the ordering on the connectors on the specified side of their boxes.
protected  void setRow(Row row)
          Set the row for this net.
protected  void setRowNumber(int rowNum)
          Set the row number on all boxes connected to this net.
protected  void setRowOrder(boolean negdir)
          Set the row ordering for this net.
protected  void setTrack(Track track)
          Set the track to use for routing this net.
protected static void sortBySpan(Net[] nets)
          Sort an array of nets based on span.
protected  void split()
          Split the net into multiple nets if it spans rows.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

layout

protected Layout layout
Our layout.

name

protected java.lang.String name
Our name.

connectorsVector

protected java.util.Vector connectorsVector
The connectors attached to this net, as we build it.

connectors

protected Connector[] connectors
The connectors attached to this net.

rowNumber

protected int rowNumber
Our row number.

rowNumberSet

protected boolean rowNumberSet
True when rowNumber is set.

row

protected Row row
The row containing this net.

rowOrder

protected int rowOrder
The ordinal number of our position within our row.

orderSet

protected boolean orderSet
True when the row order has been set for this net.

minR

protected int minR
The minimum R coordinate of the routing span.

maxR

protected int maxR
The maximum R coordinate of the routing span.

angle

protected int angle
The routing angle for this net.

LEFT

public static int LEFT

RIGHT

public static int RIGHT

track

protected Track track
The routing track to use for this net.

paths

protected java.awt.Point[][] paths
The points comprising our routing path. Each paths[n] is an array of points for one path.
Constructor Detail

Net

public Net(Layout layout,
           java.lang.String name)
Create a new net.
Method Detail

clearConnectors

protected void clearConnectors()
Clear the connectors for the net.

addConnector

protected void addConnector(Connector conn)
Add a connector to this net.

connectorsDone

protected void connectorsDone()
Note all the connectors have been added.

clearRowNumber

protected void clearRowNumber()
Clear the row number.

setRowNumber

protected void setRowNumber(int rowNum)
Set the row number on all boxes connected to this net.

setRow

protected void setRow(Row row)
Set the row for this net.

split

protected void split()
Split the net into multiple nets if it spans rows.

clearRowOrder

protected void clearRowOrder()
Clear the row ordering for this net.

setRowOrder

protected void setRowOrder(boolean negdir)
Set the row ordering for this net.

isRowOrderSet

protected boolean isRowOrderSet()
Return true if the row order has already been set on this net.

setConnectorsRowOrder

protected void setConnectorsRowOrder(int side,
                                     boolean negdir)
Set the ordering on the connectors on the specified side of their boxes.
Parameters:
side - the side of the box into which connectors we propagate.
negdir - true means new items are added to the lesser end of the row.

addNetForce

protected void addNetForce(Connector conn,
                           int[] forcesums)
Add in the force data from the specified connector to all other connectors on the net. The force is the sum of the difference in the R coordinates between the specified connector and the other connectors on the net.
Parameters:
conn - the origin connector.
forcesums - [0] is the force sum, [1] is the count. We add to these two numbers.

calculateSpan

protected void calculateSpan()
Calculate the span of the net. The span is the minimum and maximum values of the R coordinate of all connectors on the net.

calculateRoutingAngle

protected void calculateRoutingAngle()
Calculate the routing angle of the net.

needsTrackAssignment

protected boolean needsTrackAssignment()
Return true if we need to do a track assignment for this net.

setTrack

protected void setTrack(Track track)
Set the track to use for routing this net.

route

protected void route()
Route the net.

createPath

protected java.awt.Point[] createPath(int x0,
                                      int y0,
                                      int x1,
                                      int y1)
Create a path with two points.

sortBySpan

protected static void sortBySpan(Net[] nets)
Sort an array of nets based on span.

addToBounds

protected void addToBounds(BoundsRectangle bounds)
Increase the bounds if necessary to include the paths of this net.

paint

protected void paint(LayoutGraphics g)
Draw all of the lines for this net.

dump

public void dump(java.io.PrintWriter f,
                 java.lang.String prefix,
                 boolean details)
Dump a net for debugging.

dump

public static void dump(java.io.PrintWriter f,
                        Net[] nets,
                        java.lang.String prefix,
                        boolean details)
Dump an array of nets.