swarm.space
Interface DblBuffer2d

All Known Subinterfaces:
Ca2d, ConwayLife2d, Diffuse2d
All Known Implementing Classes:
DblBuffer2dImpl

public abstract interface DblBuffer2d
extends Discrete2dS, Discrete2d

A double buffered space.. DblBuffer2d augments Discrete2d to provide a form of double buffered space. Two lattices are maintained: lattice (the current state), and newLattice (the future state). All reads take place from lattice, all writes take place to newLattice. newLattice is copied to lattice when updateLattice is called. DblBuffer2d can be used to implement one model of concurrent action, like in Ca2ds. NOTE: be very careful if you're using low-level macro access to the world, in particular be sure that you preserve the write semantics on the newLattice.


Method Summary
 Object putObject$atX$Y(Object anObject, int x, int y)
          Overridden so writes happen to newLattice.
 Object putValue$atX$Y(long v, int x, int y)
          Overridden so writes happen to newLattice.
 Object updateLattice()
          Copy newLattice to lattice, in effect updating the lattice.
 
Methods inherited from interface swarm.space.Discrete2d
copyDiscrete2d$toDiscrete2d, fastFillWithObject, fastFillWithValue, fillWithObject, fillWithValue, getObjectAtX$Y, getSizeX, getSizeY, getValueAtX$Y, setDiscrete2d$toFile
 
Methods inherited from interface swarm.objectbase.SwarmObject
getCompleteProbeMap, getProbeForMessage, getProbeForVariable, getProbeMap
 
Methods inherited from interface swarm.defobj.Drop
drop
 
Methods inherited from interface swarm.defobj.DefinedObject
compare, describe, describeID, getDisplayName, getTypeName, getZone, perform, perform$with, perform$with$with, perform$with$with$with, respondsTo, setDisplayName, xfprint, xfprintid, xprint, xprintid
 

Method Detail

updateLattice

public Object updateLattice()
Copy newLattice to lattice, in effect updating the lattice.

putObject$atX$Y

public Object putObject$atX$Y(Object anObject,
                              int x,
                              int y)
Overridden so writes happen to newLattice.
Specified by:
putObject$atX$Y in interface Discrete2d

putValue$atX$Y

public Object putValue$atX$Y(long v,
                             int x,
                             int y)
Overridden so writes happen to newLattice.
Specified by:
putValue$atX$Y in interface Discrete2d