public class Lattice2DGenerator extends java.lang.Object implements GraphGenerator
Constructor and Description |
---|
Lattice2DGenerator(int latticeSize,
boolean isToroidal)
Constructs an instance of the lattice generator
|
Modifier and Type | Method and Description |
---|---|
protected int |
downIndex(int currentLatticeRow,
int currentLatticeColumn) |
ArchetypeGraph |
generateGraph()
Instructs the algorithm to generate the graph
|
int |
getLatticeSize() |
protected int |
leftIndex(int currentLatticeRow,
int currentLatticeColumn) |
protected int |
rightIndex(int currentLatticeRow,
int currentLatticeColumn) |
protected int |
upIndex(int currentLatticeRow,
int currentLatticeColumn) |
public Lattice2DGenerator(int latticeSize, boolean isToroidal)
latticeSize
- the size of the lattice, n, thus creating an n x n lattice.isToroidal
- whether the lattice wraps around or notpublic ArchetypeGraph generateGraph()
GraphGenerator
generateGraph
in interface GraphGenerator
protected int upIndex(int currentLatticeRow, int currentLatticeColumn)
protected int downIndex(int currentLatticeRow, int currentLatticeColumn)
protected int leftIndex(int currentLatticeRow, int currentLatticeColumn)
protected int rightIndex(int currentLatticeRow, int currentLatticeColumn)
public int getLatticeSize()