swarm.space
Interface DblBuffer2d

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

public interface DblBuffer2d
extends Discrete2d, Discrete2dS

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
 java.lang.Object putObject$atX$Y(java.lang.Object anObject, int x, int y)
           
 java.lang.Object putValue$atX$Y(int v, int x, int y)
          Overridden so writes happen to newLattice.
 java.lang.Object updateLattice()
          Copy newLattice to lattice, in effect updating the lattice.
 
Methods inherited from interface swarm.space.Discrete2d
copyDiscrete2d$toDiscrete2d, fastFillWithObject, fastFillWithValue, fillWithObject, fillWithValue, setDiscrete2d$toFile
 
Methods inherited from interface swarm.space.Discrete2dS
setObjectFlag
 
Methods inherited from interface swarm.objectbase.SwarmObject
getCompleteProbeMap, getProbeForMessage, getProbeForVariable, getProbeMap
 
Methods inherited from interface swarm.space.GridData
getObjectAtX$Y, getSizeX, getSizeY, getValueAtX$Y
 
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
 
Methods inherited from interface swarm.defobj.GetName
getName
 

Method Detail

updateLattice

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

putObject$atX$Y

public java.lang.Object putObject$atX$Y(java.lang.Object anObject,
                                        int x,
                                        int y)
Specified by:
putObject$atX$Y in interface Discrete2d

putValue$atX$Y

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