|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.speckled.specksim.imp.specks.AbstractSpeck
public abstract class AbstractSpeck
Eases implementation by handling allocation of ids, logging control and repeatable random number generation. All Speck implementations should probably subclass this.
| Field Summary | |
|---|---|
java.lang.String |
name
The name of this speck type |
protected static java.lang.String |
RNG_OFFSET_CONF_DESC
The description to use for configuring the RNG seed offset |
protected static java.lang.String |
RNG_OFFSET_CONF_NAME
The name to use for configuring the RNG seed offset |
protected static SpeckCapability |
simulator
A reference to the simulator that contains this speck |
| Fields inherited from interface com.speckled.specksim.Speck |
|---|
ID_BITS, SPECK_LOG_SOURCE |
| Constructor Summary | |
|---|---|
AbstractSpeck(java.lang.String name)
Standard constructor |
|
| Method Summary | |
|---|---|
java.lang.String |
getFlavourName()
Gets a name for this flavour of Speck |
protected java.util.Random |
getRandom()
Gets the random number generator for this speck. |
static int |
getRandomSeedOffset()
Gets the current value of the random seed offset. |
int |
id()
Gets a unique identifier for this speck |
abstract void |
init()
Called when the speck is added to the simulator, and when the simulator is reset. |
void |
initialise(SpeckCapability simulator)
Called when the speck is added to the simulator, and when the simulator is reset. |
boolean |
isLoggingEnabled()
Checks whether this speck should be logging events. |
void |
setID(int ID)
Sets this speck's ID. |
void |
setLoggingEnabled(boolean b)
Sets whether this speck should log any messages |
static void |
setRandomSeedOffset(int offset)
Sets the random seed offset. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.speckled.specksim.Speck |
|---|
deInit, getState, shellEncountered |
| Methods inherited from interface com.ryanm.config.Configurable |
|---|
getConfigurator |
| Field Detail |
|---|
public final java.lang.String name
protected static SpeckCapability simulator
protected static final java.lang.String RNG_OFFSET_CONF_NAME
protected static final java.lang.String RNG_OFFSET_CONF_DESC
| Constructor Detail |
|---|
public AbstractSpeck(java.lang.String name)
name - The name for this type of speck| Method Detail |
|---|
public final int id()
Speck
id in interface Speckpublic final java.lang.String getFlavourName()
Speck
getFlavourName in interface Speckpublic final void setID(int ID)
Speck
setID in interface SpeckID - The ID to setpublic final void initialise(SpeckCapability simulator)
Speck
initialise in interface Specksimulator - The simulator that the speck is added topublic abstract void init()
public boolean isLoggingEnabled()
public void setLoggingEnabled(boolean b)
b - true to enable logging, false to disableprotected java.util.Random getRandom()
@ConfigurableVariable(value="RNG seed offset") public static int getRandomSeedOffset()
@ConfigurableVariable(value="RNG seed offset") @Description(value="Used for generating random numbers") @Priority(value=100) public static void setRandomSeedOffset(int offset)
offset - The new offset valuepublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||