|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gzz.impl.AbstractDim
Abstract implementation of Dim
with standard implementations
for most methods.
Some of the basic routines are given here so that they may be optimized.
The absolute core routines that every subclass must implement
are the abstract routines s, connect and disconnect.
There are also other routines which may be optimizable but they
should be implemented as separate classes.
Note that some of the methods are defined using each other; to avoid infinite loops (a la java.awt.FontMetrics) you have to implement at least one s and one h.
TestSimpleDim
Field Summary | |
protected java.lang.String |
id
The identifier. |
static java.lang.String |
rcsid
|
protected Space |
space
The space this dimension is affiliated with. |
Constructor Summary | |
AbstractDim(Space space)
Deprecated. Must provide id to constructor. |
|
AbstractDim(Space space,
java.lang.String id)
|
Method Summary | |
void |
canonicalizeCells()
|
abstract void |
connect(Cell c,
Cell d)
Connect the two cells in this dimension, in order. |
void |
connect(Cell c,
int dir,
Cell d)
Connect two cells in direction given. |
abstract void |
disconnect(Cell c,
int dir)
Disconnect the cell in the given direction. |
void |
excise(Cell c)
Remove the given cell from this dimension. |
void |
exciseRange(Cell neg,
Cell pos)
Excise a whole range of cells from a rank. |
java.lang.String |
getId()
Get the identifier of this dimension. |
Space |
getSpace()
Get the space this dimension is affilated with. |
Cell |
h(Cell c)
|
Cell |
h(Cell c,
int dir)
|
Cell |
h(Cell c,
int dir,
Obs o)
Get headcell. |
void |
hop(Cell c,
int steps)
Hop the cell along this dimension. |
void |
insert(Cell c,
int dir,
Cell d)
Insert a cell on a rank. |
void |
insertRank(Cell c,
int dir,
Cell d)
Insert a whole rank inside another rank. |
abstract boolean |
isCircularHead(Cell c,
Obs o)
Whether the given cell is a headcell of a circular rank on this dimension. |
java.util.Iterator |
iterator(Cell c)
Iterate starting from the given cell. |
Cell |
s(Cell c)
|
Cell |
s(Cell c,
int steps)
|
abstract Cell |
s(Cell c,
int steps,
Obs o)
Get another cell steps steps on the dimension from c. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface gzz.Dim |
getHeadcells, getNegsides |
Field Detail |
public static final java.lang.String rcsid
protected final Space space
protected final java.lang.String id
Constructor Detail |
public AbstractDim(Space space, java.lang.String id)
public AbstractDim(Space space)
Method Detail |
public final Space getSpace()
Dim
getSpace
in interface Dim
public final java.lang.String getId()
Dim
getId
in interface Dim
public abstract Cell s(Cell c, int steps, Obs o)
Dim
s
in interface Dim
c
- The cellsteps
- Number of steps, can be negative.public abstract void connect(Cell c, Cell d) throws gzz.errors.ZZAlreadyConnectedException
Dim
connect
in interface Dim
gzz.errors.ZZAlreadyConnectedException
- If one of the cells is
already connected.public abstract void disconnect(Cell c, int dir)
Dim
disconnect
in interface Dim
public final void connect(Cell c, int dir, Cell d) throws gzz.errors.ZZAlreadyConnectedException
connect
in interface Dim
gzz.errors.ZZAlreadyConnectedException
public Cell s(Cell c, int steps)
s
in interface Dim
public Cell s(Cell c)
s
in interface Dim
public abstract boolean isCircularHead(Cell c, Obs o)
Dim
isCircularHead
in interface Dim
public Cell h(Cell c, int dir, Obs o)
h
in interface Dim
public Cell h(Cell c, int dir)
h
in interface Dim
public Cell h(Cell c)
h
in interface Dim
public void insert(Cell c, int dir, Cell d) throws gzz.errors.ZZAlreadyConnectedException
Dim
insert
in interface Dim
c
- The cell next to which to insert the celldir
- The direction from c in which it should be insertedd
- The cell to be inserted.
gzz.errors.ZZAlreadyConnectedException
public void excise(Cell c)
excise
in interface Dim
public void hop(Cell c, int steps)
Dim
hop
in interface Dim
public void insertRank(Cell c, int dir, Cell d)
Dim
insertRank
in interface Dim
c
- The cell the rank is to be inserted at.d
- The headcell of the rank to be inserted.public void exciseRange(Cell neg, Cell pos)
Dim
exciseRange
in interface Dim
neg
- The negmost cell in the range to be excised.pos
- The posmost cell in the range to be excised.public java.util.Iterator iterator(Cell c)
iterator
in interface Dim
public void canonicalizeCells()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |