Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.port80.graph.dot.impl
Class Cell  view Cell download Cell.java

java.lang.Object
  extended bycom.port80.graph.dot.impl.Cell

public class Cell
extends java.lang.Object


Field Summary
static int BLOCKED
          Margins of a vertex, not available for routing.
static int BUS
          Virtual vertex (EDGE,EDGELABEL) center.
(package private)  int coln
          coln is x coordinate in map unit (eg.
(package private)  int[] crossCost
          Sum of all xPenalty crossing this edge (but not yet multiplied by xPenalty of the edge).
(package private)  int[] crossSaved
          Saved copy of crossCost.
(package private)  int curCost
          Current total cost from src.
private static boolean DEBUG
           
static int ERASED
          Erased vertex cell for path being routed (not include BLOCKED cells).
(package private)  int estTotal
          Estimated total=curCost+est.
private static int fCELL_BASICCOST
           
private static int fCELL_DISTCOST
           
private static int fCELL_TURNCOST
           
private static int fCELL_XDIV
           
private static int fMARKCOUNTER
          fMarkCounter is used to validate several instance variables so that they don't need to be reset uneccesarily.
private static int fXSpacing
           
(package private)  int heapIndex
          The index in CellHeap.
(package private)  boolean isCrossSaved
          //DEBUG: sanity check.
(package private)  Cell leftVertex
          The first VERTEX cell to the left of this.
private  int mark
          Mark that cell has been visited.
private static java.lang.String NAME
           
(package private)  Cell parent
          Parent cell on the best path to this cell.
static int QUEUE
           
static int REJECT
          Bus vertex (BUS) center.
static int REQUEUE
           
(package private)  int rown
          rown is 0-based.
static int SPACE
          Available for routing.
(package private)  int type
           
private static boolean USEBLOCKED
          Mark cells occupied by vertex as BLOCKED instead of SPACE.
(package private)  VirtualVertex vertex
          The vertex at this cell.
static int VERTEX
          Vertex center, type>VERTEX are occupied by a VirtualVertex, not available for routing.
static int VIRTUAL
           
 
Constructor Summary
(package private) Cell(int esttotal)
          For CellHeap testing.
private Cell(int rn, int cn)
           
private Cell(int type, int rn, int cn, VirtualVertex v)
           
 
Method Summary
 int accept(Cell parent, Cell dest, int cost)
          Visit this cell from parent through the edge chain 'chain'.
(package private)  boolean checkSavedCrossCost()
           
(package private) static void configure(VirtualGraph graph)
           
(package private)  int distCostFrom(Cell parent)
          Calculate cost due to distance between this and the parent cell.
 boolean equals(java.lang.Object a)
          Determine whether this Object is semantically equal to another Object.
(package private)  void erase(CellList ret, Cell[][] map)
          Convert this cell to ERASED and BLOCKED cells around it to SPACE.
(package private)  int estimate(Cell dest)
          Estimate cost to destination.
(package private)  Cell findLeftVertex(Cell[][] map)
           
(package private)  VirtualVertex getVertex()
           
(package private)  void init()
           
 int lowerCostThan(Cell a)
           
(package private) static Cell newBlockedCell(int rn, int cn, VirtualVertex v)
           
(package private) static Cell newSpaceCell(int rn, int cn)
           
(package private) static Cell newVertexCell(int rn, int cn, VirtualVertex v)
           
(package private)  boolean reached(Cell dest)
          Check if this cell is one of the destination.
 void reset()
          Reset to init.
(package private) static void resetMark()
           
(package private)  void restore(Cell c)
          Restore cell from previous save state.
(package private)  void restoreCrossCost()
           
(package private)  Cell save()
           
(package private)  void saveCrossCost()
           
(package private)  void setLeftVertex(Cell c)
           
(package private)  void setVertex(VirtualVertex v, Cell[][] map)
          Set a cell to vertex 'v' and change cells within its width to be BLOCKED.
 void toGeneralPath(java.lang.StringBuffer buf, java.lang.String fill)
           
 java.lang.String toString()
          Convert this Object to a human-readable String.
(package private)  int travelCostFrom(Cell parent, Cell grandparent)
          Calculate cost for transversing from parent to this cell.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME

private static final java.lang.String NAME
See Also:
Constant Field Values

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values

USEBLOCKED

private static final boolean USEBLOCKED
Mark cells occupied by vertex as BLOCKED instead of SPACE.

See Also:
Constant Field Values

SPACE

public static final int SPACE
Available for routing.

See Also:
Constant Field Values

BLOCKED

public static final int BLOCKED
Margins of a vertex, not available for routing.

See Also:
Constant Field Values

ERASED

public static final int ERASED
Erased vertex cell for path being routed (not include BLOCKED cells).

See Also:
Constant Field Values

VERTEX

public static final int VERTEX
Vertex center, type>VERTEX are occupied by a VirtualVertex, not available for routing.

See Also:
Constant Field Values

VIRTUAL

public static final int VIRTUAL
See Also:
Constant Field Values

BUS

public static final int BUS
Virtual vertex (EDGE,EDGELABEL) center.

See Also:
Constant Field Values

REJECT

public static final int REJECT
Bus vertex (BUS) center.

See Also:
Constant Field Values

QUEUE

public static final int QUEUE
See Also:
Constant Field Values

REQUEUE

public static final int REQUEUE
See Also:
Constant Field Values

fMARKCOUNTER

private static int fMARKCOUNTER
fMarkCounter is used to validate several instance variables so that they don't need to be reset uneccesarily. These variables that are valid only if mark==fMarkCounter, otherwise, they should be initialized before use.


mark

private int mark
Mark that cell has been visited. Each routing increment a counter for the mark and thus no need to reset the mark after each routing.


heapIndex

int heapIndex
The index in CellHeap. Used to remove this cell from the heap. If this cell is not in the a CellHeap, heapIndex==0.


curCost

int curCost
Current total cost from src. to this cell.


estTotal

int estTotal
Estimated total=curCost+est.


parent

Cell parent
Parent cell on the best path to this cell.


type

int type

rown

int rown
rown is 0-based. row 0 represents graph.ranks[minRank].


coln

int coln
coln is x coordinate in map unit (eg. =xSpacing/XDIV).


vertex

VirtualVertex vertex
The vertex at this cell. Note that BLOCKED cells are also label with vertex so that they can be erased properly. So to check for cell representing a vertex, use type>=VERTEX.


crossCost

int[] crossCost
Sum of all xPenalty crossing this edge (but not yet multiplied by xPenalty of the edge).


crossSaved

int[] crossSaved
Saved copy of crossCost.


isCrossSaved

boolean isCrossSaved
//DEBUG: sanity check.


leftVertex

Cell leftVertex
The first VERTEX cell to the left of this.


fCELL_XDIV

private static int fCELL_XDIV

fCELL_BASICCOST

private static int fCELL_BASICCOST

fCELL_DISTCOST

private static int fCELL_DISTCOST

fCELL_TURNCOST

private static int fCELL_TURNCOST

fXSpacing

private static int fXSpacing
Constructor Detail

Cell

Cell(int esttotal)
For CellHeap testing.


Cell

private Cell(int rn,
             int cn)

Cell

private Cell(int type,
             int rn,
             int cn,
             VirtualVertex v)
Method Detail

configure

static void configure(VirtualGraph graph)

resetMark

static void resetMark()

newVertexCell

static Cell newVertexCell(int rn,
                          int cn,
                          VirtualVertex v)

newBlockedCell

static Cell newBlockedCell(int rn,
                           int cn,
                           VirtualVertex v)

newSpaceCell

static Cell newSpaceCell(int rn,
                         int cn)

init

void init()

getVertex

VirtualVertex getVertex()

save

Cell save()

saveCrossCost

void saveCrossCost()

restoreCrossCost

void restoreCrossCost()

checkSavedCrossCost

boolean checkSavedCrossCost()

restore

void restore(Cell c)
Restore cell from previous save state. Only type and vertex may have changed.


setVertex

void setVertex(VirtualVertex v,
               Cell[][] map)
Set a cell to vertex 'v' and change cells within its width to be BLOCKED.


estimate

int estimate(Cell dest)
Estimate cost to destination.


setLeftVertex

void setLeftVertex(Cell c)

findLeftVertex

Cell findLeftVertex(Cell[][] map)

erase

void erase(CellList ret,
           Cell[][] map)
Convert this cell to ERASED and BLOCKED cells around it to SPACE. BLOCKED.vertex are cleared, but this.vertex stay since it is required for cross-cost calculation.


reached

boolean reached(Cell dest)
Check if this cell is one of the destination. FIXME: For now, we always have line destination.


distCostFrom

int distCostFrom(Cell parent)
Calculate cost due to distance between this and the parent cell. Ignore turnings that are considered in travelCostFrom().


travelCostFrom

int travelCostFrom(Cell parent,
                   Cell grandparent)
Calculate cost for transversing from parent to this cell.


lowerCostThan

public int lowerCostThan(Cell a)

accept

public int accept(Cell parent,
                  Cell dest,
                  int cost)
Visit this cell from parent through the edge chain 'chain'.


reset

public void reset()
Reset to init. state.


equals

public boolean equals(java.lang.Object a)
Description copied from class: java.lang.Object
Determine whether this Object is semantically equal to another Object.

There are some fairly strict requirements on this method which subclasses must follow:

  • It must be transitive. If a.equals(b) and b.equals(c), then a.equals(c) must be true as well.
  • It must be symmetric. a.equals(b) and b.equals(a) must have the same value.
  • It must be reflexive. a.equals(a) must always be true.
  • It must be consistent. Whichever value a.equals(b) returns on the first invocation must be the value returned on all later invocations.
  • a.equals(null) must be false.
  • It must be consistent with hashCode(). That is, a.equals(b) must imply a.hashCode() == b.hashCode(). The reverse is not true; two objects that are not equal may have the same hashcode, but that has the potential to harm hashing performance.

This is typically overridden to throw a java.lang.ClassCastException if the argument is not comparable to the class performing the comparison, but that is not a requirement. It is legal for a.equals(b) to be true even though a.getClass() != b.getClass(). Also, it is typical to never cause a java.lang.NullPointerException.

In general, the Collections API (java.util) use the equals method rather than the == operator to compare objects. However, java.util.IdentityHashMap is an exception to this rule, for its own good reasons.

The default implementation returns this == o.


toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


toGeneralPath

public void toGeneralPath(java.lang.StringBuffer buf,
                          java.lang.String fill)