T
- The type of CellGame that uses this SpaceThinker's SpaceStatesU
- The type of SpaceState that uses this SpaceThinkerV
- The type of SpaceThinker that this SpaceThinker is for SpaceState
interaction purposespublic abstract class SpaceThinker<T extends CellGame,U extends SpaceState<T,U,V>,V extends SpaceThinker<T,U,V>> extends SubThinker<T,U,V>
A SpaceThinker is the type of SubThinker that is used by SpaceStates. A SpaceThinker has beforeMovementActions() that it takes once each frame, after all Thinkers have experienced all of their time units for that frame, but before its SpaceState moves its assigned MobileObjects. Like a SpaceState, it also has an EventGroup of before-movement Events that it performs once each frame. A SpaceThinker performs these events immediately after it takes its beforeMovementActions(). Both taking beforeMovementActions() and performing before-movement Events count as time-dependent actions, and thus a SpaceThinker will only do them when assigned to an active SpaceState.
Similarly to its frameActions(), the process in which a SpaceThinker takes its beforeMovementActions() and then performs its before-movement Events is itself an Event, and the SpaceThinker automatically ensures that this Event is in the before-movement Events of its current super-Thinker. The SpaceThinker's before-movement priority (0 by default) is the Event's priority in its super-Thinker's before-movement Events. This means that the SpaceThinkers assigned to a given Thinker will take their beforeMovementActions() in order from highest to lowest before-movement priority, and that a SpaceThinker will take its beforeMovementActions() after its super-Thinker, but, if its super-Thinker is itself a SpaceThinker, before the next Thinker assigned to its super-Thinker's super-Thinker.
SpaceState
,
ThinkerObject
Constructor and Description |
---|
SpaceThinker(java.lang.Class<T> gameClass,
java.lang.Class<U> stateClass,
java.lang.Class<V> subThinkerClass)
Constructs a SpaceThinker.
|
Modifier and Type | Method and Description |
---|---|
void |
addSubThinkerActions(T game,
U state,
V subThinker)
Actions for this Thinker to take immediately after adding a SubThinker to
itself, before the added SubThinker takes its addedActions().
|
void |
beforeMovementActions(T game,
U state)
Actions for this SpaceThinker to take once each frame, after all Thinkers
have experienced all of their time units for that frame, but before its
SpaceState moves its assigned MobileObjects.
|
EventGroup<T,U> |
getBeforeMovementEvents()
Returns the EventGroup of this SpaceThinker's before-movement Events.
|
int |
getBeforeMovementPriority()
Returns this SpaceThinker's before-movement priority.
|
void |
removeSubThinkerActions(T game,
U state,
V subThinker)
Actions for this Thinker to take immediately before removing a SubThinker
from itself, after the soon-to-be-removed SubThinker takes its
removedActions().
|
void |
setBeforeMovementPriority(int beforeMovementPriority)
Sets this SpaceThinker's before-movement priority to the specified value.
|
addedActions, getEffectiveTimeFactor, getFramePriority, getGame, getGameState, getNewSuperThinker, getSuperThinker, getThis, removedActions, setFramePriority, setSuperThinker
addSubThinker, clearLineages, clearSubThinkers, frameActions, getFrameEvents, getGameClass, getNumSubThinkers, getStateClass, getSubThinkerClass, getTimeFactor, getTimerValue, iteratingThroughSubThinkers, removeLineage, removeSubThinker, setTimeFactor, setTimerValue, subThinkerIterator
public SpaceThinker(java.lang.Class<T> gameClass, java.lang.Class<U> stateClass, java.lang.Class<V> subThinkerClass)
gameClass
- The Class object representing the type of CellGame that
uses this SpaceThinker's SpaceStatesstateClass
- The Class object representing the type of SpaceState
that uses this SpaceThinkersubThinkerClass
- The Class object representing the type of
SpaceThinker that this SpaceThinker is for SpaceState interaction
purposespublic void beforeMovementActions(T game, U state)
game
- This SpaceThinker's SpaceState's CellGamestate
- This SpaceThinker's SpaceStatepublic void addSubThinkerActions(T game, U state, V subThinker)
Thinker
addSubThinkerActions
in class Thinker<T extends CellGame,U extends SpaceState<T,U,V>,V extends SpaceThinker<T,U,V>>
game
- This Thinker's GameState's CellGame, or null if it has no
GameStatestate
- This Thinker's GameState, or null if it has nonesubThinker
- The SubThinker that was addedpublic void removeSubThinkerActions(T game, U state, V subThinker)
Thinker
removeSubThinkerActions
in class Thinker<T extends CellGame,U extends SpaceState<T,U,V>,V extends SpaceThinker<T,U,V>>
game
- This Thinker's GameState's CellGame, or null if it has no
GameStatestate
- This Thinker's GameState, or null if it has nonesubThinker
- The SubThinker that is about to be removedpublic final EventGroup<T,U> getBeforeMovementEvents()
public final int getBeforeMovementPriority()
public final void setBeforeMovementPriority(int beforeMovementPriority)
beforeMovementPriority
- This SpaceThinker's new before-movement
priority