jimmc.treepar
Class Row

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

public class Row
extends java.lang.Object

Row represents a single row of the layout. There are two types of Row: a box row, and a channel row. A box row contains a set of Box objects; a channel row contains a set of Track objects.


Field Summary
protected  Box[] boxes
          The boxes in the row, after setup.
protected  java.util.Vector boxesVector
          The boxes in this row, during setup.
protected  Layout layout
          Our layout.
protected  int length
          Our length.
protected  Net[] nets
          The nets in this row, after setup.
protected  java.util.Vector netsVector
          The nets in this row, during setup.
protected  int position
          Our position (S coordinate).
protected  int rowNumber
          Our row number.
protected  int rowOrderMax
          Maximum ordering position of an item in this row.
protected  int rowOrderMin
          Minimum ordering position of an item in this row.
protected  int thickness
          Our thickness.
protected  java.util.Vector tracksVector
          The tracks in this row, when it is a channel row.
 
Constructor Summary
Row(Layout layout, int rowNumber)
          Create a new empty row.
 
Method Summary
protected  void addBox(Box box)
          Add a box to this row.
protected  void addNet(Net net)
          Add a net to this row.
protected  void balance(int side)
          Move the row as a whole in the R dimension to minimize the force on the specified connectors.
protected  void balanceAndSpread(int side)
          Spread out the boxes in a row to minimize line lengths.
protected  int calculateThickness()
          Calculate the thickness of the row when it is a box row.
protected  void clearRowOrder()
          Clear the row ordering info.
protected  boolean contains(int x, int y)
          True if this row contains the specified point.
static void dump(java.io.PrintWriter f, Row[] rows, java.lang.String prefix, boolean details)
          Dump an array of rows.
 void dump(java.io.PrintWriter f, java.lang.String prefix, boolean details)
          Dump a row for debugging.
protected  Track findTrack(int minR, int maxR, int angle)
          Find a track into which the specified span will fit.
protected  Track findTrackGreedy(int minR, int maxR, int angle)
          Find a track into which the specified span will fit, using a greedy algorithm.
protected  Track findTrackLast(int minR, int maxR, int angle)
          Find a track into which the specified span will fit, using a generous algorithm.
protected  int getBalanceDistance(int side)
          Get the distance needed to move the row to the optimal balanced position.
protected  LayoutHitText getHitText(int x, int y)
          Find the text at the specified point.
protected  int getLength()
          Get the length of the row.
protected  int getS()
          Get our S coordinate.
protected  int getThickness()
          Get the previously calculated thickness.
protected  boolean isBoxRow()
          Return true if this row contains boxes.
protected  void normalize()
          Set the R position of the boxes within this row, assuming minimal spacing between boxes.
protected  void route()
          Do the channel route for this row.
protected  void setChannelSize()
          Set the channel size for the row.
protected  void setS(int pos)
          Set our position (S coordinate).
protected  void setupDone()
          Call this when done adding boxes and nets.
protected  void spread(int side)
          Spread out the boxes within the row to minimize the force on the specified connectors of each box.
 
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.

rowNumber

protected int rowNumber
Our row number.

position

protected int position
Our position (S coordinate).

thickness

protected int thickness
Our thickness.

length

protected int length
Our length.

boxesVector

protected java.util.Vector boxesVector
The boxes in this row, during setup.

boxes

protected Box[] boxes
The boxes in the row, after setup.

netsVector

protected java.util.Vector netsVector
The nets in this row, during setup.

nets

protected Net[] nets
The nets in this row, after setup.

rowOrderMin

protected int rowOrderMin
Minimum ordering position of an item in this row.

rowOrderMax

protected int rowOrderMax
Maximum ordering position of an item in this row.

tracksVector

protected java.util.Vector tracksVector
The tracks in this row, when it is a channel row.
Constructor Detail

Row

public Row(Layout layout,
           int rowNumber)
Create a new empty row.
Method Detail

addBox

protected void addBox(Box box)
Add a box to this row.

addNet

protected void addNet(Net net)
Add a net to this row.

setupDone

protected void setupDone()
Call this when done adding boxes and nets.

setS

protected void setS(int pos)
Set our position (S coordinate).

getS

protected int getS()
Get our S coordinate.

isBoxRow

protected boolean isBoxRow()
Return true if this row contains boxes.

calculateThickness

protected int calculateThickness()
Calculate the thickness of the row when it is a box row. The thickness is the maximum of the thickness of all boxes in the row.

getThickness

protected int getThickness()
Get the previously calculated thickness.

getLength

protected int getLength()
Get the length of the row.

clearRowOrder

protected void clearRowOrder()
Clear the row ordering info.

normalize

protected void normalize()
Set the R position of the boxes within this row, assuming minimal spacing between boxes. This gives us a minimum length for the row.

balanceAndSpread

protected void balanceAndSpread(int side)
Spread out the boxes in a row to minimize line lengths. This changes the R position of the boxes within the row.

balance

protected void balance(int side)
Move the row as a whole in the R dimension to minimize the force on the specified connectors.

getBalanceDistance

protected int getBalanceDistance(int side)
Get the distance needed to move the row to the optimal balanced position.

spread

protected void spread(int side)
Spread out the boxes within the row to minimize the force on the specified connectors of each box. First we go through all the boxes starting at the low-R end of the row and see if we can pull boxes toward lower R; then we go through the boxes in the other direction, from the high-R end, and see if we can pull any boxes toward higher R.

setChannelSize

protected void setChannelSize()
Set the channel size for the row. This sets thickness for a channel row.

findTrack

protected Track findTrack(int minR,
                          int maxR,
                          int angle)
Find a track into which the specified span will fit.

findTrackGreedy

protected Track findTrackGreedy(int minR,
                                int maxR,
                                int angle)
Find a track into which the specified span will fit, using a greedy algorithm.

findTrackLast

protected Track findTrackLast(int minR,
                              int maxR,
                              int angle)
Find a track into which the specified span will fit, using a generous algorithm. Find the last row in which the span does not fit, then return the row after that.

route

protected void route()
Do the channel route for this row.

contains

protected boolean contains(int x,
                           int y)
True if this row contains the specified point.

getHitText

protected LayoutHitText getHitText(int x,
                                   int y)
Find the text at the specified point.

dump

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

dump

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