de.cesr.more.building.util
Class MLattice2DGenerator<T,E extends MoreEdge<T>>

java.lang.Object
  extended by de.cesr.more.building.util.MLattice2DGenerator<T,E>

public class MLattice2DGenerator<T,E extends MoreEdge<T>>
extends Object

MORe Based on repast.simphony.context.space.graph.Lattice2DGenerator Exchanged HashSet by LinkedHashSet that preserves the order of node elements, which is crucial for building up a lattice.

Date:
24.08.2011

Field Summary
protected  boolean isToroidal
           
protected  int latticeSize
           
 
Constructor Summary
MLattice2DGenerator(boolean isToroidal)
           
 
Method Summary
 MoreNetwork<T,E> createNetwork(MoreNetwork<T,E> network, MoreNetworkEdgeModifier<T,E> edgeModifier)
          Given an existing network, add edges to create a 2D lattice.
protected  int downIndex(int currentLatticeRow, int currentLatticeColumn)
           
protected  int leftIndex(int currentLatticeRow, int currentLatticeColumn)
           
protected  int rightIndex(int currentLatticeRow, int currentLatticeColumn)
           
protected  int upIndex(int currentLatticeRow, int currentLatticeColumn)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isToroidal

protected boolean isToroidal

latticeSize

protected int latticeSize
Constructor Detail

MLattice2DGenerator

public MLattice2DGenerator(boolean isToroidal)
Parameters:
@param - isToroidal whether lattice wraps or not.
Method Detail

createNetwork

public MoreNetwork<T,E> createNetwork(MoreNetwork<T,E> network,
                                      MoreNetworkEdgeModifier<T,E> edgeModifier)
Given an existing network, add edges to create a 2D lattice. The lattice dimension n is the square root of the number of nodes in the specified network. The resulting lattice will be nxn.

Parameters:
network - the network to rewire
Returns:
the created network

upIndex

protected int upIndex(int currentLatticeRow,
                      int currentLatticeColumn)

downIndex

protected int downIndex(int currentLatticeRow,
                        int currentLatticeColumn)

leftIndex

protected int leftIndex(int currentLatticeRow,
                        int currentLatticeColumn)

rightIndex

protected int rightIndex(int currentLatticeRow,
                         int currentLatticeColumn)