T
- The type of CellGame that uses this ThinkerObject's SpaceThinker's
SpaceStatesU
- The type of SpaceState that uses this ThinkerObject's SpaceThinkerV
- The type of SpaceThinker that this ThinkerObject mimicspublic abstract class ThinkerObject<T extends CellGame,U extends SpaceState<T,U,V>,V extends SpaceThinker<T,U,V>> extends MobileObject
A ThinkerObject is a MobileObject that mimics a type of SpaceThinker by permanently assigning to itself a SpaceThinker of that type. A ThinkerObject has methods that access and manipulate properties of its assigned SpaceThinker, such as its timers and list of its own SpaceThinkers, allowing the ThinkerObject to effectively inherit those properties. A ThinkerObject will automatically set its assigned SpaceThinker's time factor and add and remove it from SpaceStates that can use it as appropriate to match the ThinkerObject's own time factor and assigned SpaceState.
SpaceThinker
Constructor and Description |
---|
ThinkerObject()
Constructs a ThinkerObject with no locator Hitbox or assigned
SpaceThinker.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addSubThinker(V subThinker)
Adds the specified SpaceThinker to this ThinkerObject if it is not
already assigned to a Thinker, and if doing so would not create a loop of
assignments in which SpaceThinkers are directly or indirectly assigned to
themselves.
|
void |
clearLineages()
Removes from their super-Thinkers all of the SpaceThinkers that are
directly or indirectly assigned to this Thinker.
|
void |
clearSubThinkers()
Removes from this ThinkerObject all of the SpaceThinkers that are
currently assigned to it.
|
EventGroup<T,U> |
getBeforeMovementEvents()
Returns the EventGroup of this ThinkerObject's before-movement Events.
|
int |
getBeforeMovementPriority()
Returns this ThinkerObject's before-movement priority.
|
EventGroup<T,U> |
getFrameEvents()
Returns the EventGroup of this ThinkerObject's frame Events.
|
int |
getFramePriority()
Returns this ThinkerObject's frame priority.
|
java.lang.Class<T> |
getGameClass()
Returns the Class object representing the type of CellGame that uses this
ThinkerObject's SpaceThinker's SpaceStates.
|
int |
getNumSubThinkers()
Returns the number of SpaceThinkers that are assigned to this
ThinkerObject.
|
java.lang.Class<U> |
getStateClass()
Returns the Class object representing the type of SpaceState that uses
this ThinkerObject's SpaceThinker.
|
java.lang.Class<V> |
getSubThinkerClass()
Returns the Class object representing the type of SpaceThinker that
this ThinkerObject mimics.
|
V |
getThinker()
Returns this ThinkerObject's assigned SpaceThinker, or null if it has
none.
|
int |
getTimerValue(Event<T,U> event)
Returns the current value of this ThinkerObject's timer for the specified
Event.
|
boolean |
iteratingThroughSubThinkers()
Returns whether any Iterators over this ThinkerObject's list of
SpaceThinkers are in progress.
|
boolean |
removeLineage(V subThinker)
Removes from their super-Thinkers all of the SpaceThinkers that are
directly or indirectly assigned to this ThinkerObject, and are either
assigned to or assignees of the specified SpaceThinker.
|
boolean |
removeSubThinker(V subThinker)
Removes the specified SpaceThinker from this ThinkerObject if it is
currently assigned to it.
|
void |
setBeforeMovementPriority(int beforeMovementPriority)
Sets this ThinkerObject's before-movement priority to the specified
value.
|
void |
setFramePriority(int framePriority)
Sets this ThinkerObject's frame priority to the specified value.
|
boolean |
setThinker(V thinker)
Sets this ThinkerObject's assigned SpaceThinker to the specified one, if
this ThinkerObject does not already have a SpaceThinker and the
specified SpaceThinker is not already assigned to a Thinker.
|
void |
setTimerValue(Event<T,U> event,
int value)
Sets the value of this ThinkerObject's timer for the specified Event to
the specified value.
|
SafeIterator<V> |
subThinkerIterator()
Returns a new SafeIterator over this ThinkerObject's list of
SpaceThinkers.
|
addFollower, changePosition, changePosition, changeStep, changeStep, changeStepX, changeStepY, changeX, changeY, clearFollowers, collide, collided, collided, doMovement, doMovement, getAbsPressingAngle, getCollisionDirections, getCollisionHitbox, getCollisions, getDisplacement, getDisplacementLength, getDisplacementX, getDisplacementY, getFollowers, getLeader, getMovementPriority, getNewMovementPriority, getNumFollowers, getRelPressingAngle, getSpeed, getStep, getStepLength, getStepX, getStepY, getVelocity, getVelocityX, getVelocityY, hasCollision, isPressingIn, moveToward, moveToward, removeFollower, setCollision, setCollisionHitbox, setGameState, setLeader, setMovementPriority, setPosition, setPosition, setRelPressingAngle, setRelPressingAngle, setSpeed, setStep, setStep, setStepLength, setStepX, setStepY, setVelocity, setVelocity, setVelocityX, setVelocityY, setX, setY, solidBoundingBoxesMeet
addAnimInstance, addAnimInstance, angleTo, boundingBoxesMeet, changeAngle, changePosition, changePosition, changeX, changeY, clearAnimInstances, distanceTo, draw, flipX, flipY, getAlpha, getAngle, getAngleX, getAngleY, getAnimation, getAnimation, getAnimInstance, getAnimInstance, getAppearance, getBottomEdge, getCenter, getCenterOffset, getCenterOffsetX, getCenterOffsetY, getCenterX, getCenterY, getDrawPriority, getEffectiveTimeFactor, getFilter, getGame, getGameState, getHeight, getLeftEdge, getLocatorHitbox, getNewGameState, getNumAnimInstances, getOverlapHitbox, getPosition, getRightEdge, getSolidHitbox, getTimeFactor, getTopEdge, getWidth, getX, getXFlip, getXSign, getY, getYFlip, getYSign, intersectingSolidObject, intersectingSolidObjects, isIntersectingSolidObject, isOverlappingObject, isSolid, isVisible, isVisible, nearestObject, nearestObjectWithinCircle, nearestObjectWithinCircle, nearestObjectWithinRadius, nearestObjectWithinRectangle, nearestOverlappingObject, objectIsWithinRadius, objectsWithinRadius, objectWithinRadius, overlap, overlappingObject, overlappingObjects, overlaps, removeAnimInstance, setAlpha, setAngle, setAnimation, setAnimation, setAnimInstance, setAnimInstance, setAppearance, setCenterOffset, setCenterOffset, setCenterOffsetX, setCenterOffsetY, setDrawPriority, setFilter, setGameState, setLocatorHitbox, setOverlapHitbox, setPosition, setPosition, setSolid, setSolidHitbox, setSurfaceSolid, setTimeFactor, setX, setXFlip, setY, setYFlip, surfaceIsSolid
public ThinkerObject()
public final java.lang.Class<T> getGameClass()
public final java.lang.Class<U> getStateClass()
public final java.lang.Class<V> getSubThinkerClass()
public final V getThinker()
public final boolean setThinker(V thinker)
thinker
- The SpaceThinker to be assignedpublic final int getTimerValue(Event<T,U> event)
event
- The Event whose timer value should be returnedpublic final void setTimerValue(Event<T,U> event, int value)
event
- The Event whose timer value should be setvalue
- The new value of the specified Event's timerpublic final EventGroup<T,U> getFrameEvents()
public final int getNumSubThinkers()
public final boolean iteratingThroughSubThinkers()
public final SafeIterator<V> subThinkerIterator()
public final boolean addSubThinker(V subThinker)
subThinker
- The SpaceThinker to be addedpublic final boolean removeSubThinker(V subThinker)
subThinker
- The SpaceThinker to be removedpublic final void clearSubThinkers()
public final boolean removeLineage(V subThinker)
subThinker
- The SpaceThinker with which the removed SpaceThinkers
must share a lineage of assignmentspublic final void clearLineages()
public int getFramePriority()
public void setFramePriority(int framePriority)
framePriority
- This ThinkerObject's new frame prioritypublic final EventGroup<T,U> getBeforeMovementEvents()
public final int getBeforeMovementPriority()
public final void setBeforeMovementPriority(int beforeMovementPriority)
beforeMovementPriority
- This ThinkerObject's new before-movement
priority