Mind.MentalState
Modifier and Type | Field and Description |
---|---|
static java.util.concurrent.ExecutorService |
threadPool |
static long |
UNACTIVE_TO_ASLEEP |
static long |
UNACTIVE_TO_BORED |
Constructor and Description |
---|
BasicMind() |
Modifier and Type | Method and Description |
---|---|
void |
addThought(Thought thought) |
void |
awake()
Spawn a thread to run the thoughts.
|
void |
decrementState(Mind.MentalState state)
Ensure the maximum state.
|
Bot |
getBot()
Return Bot.
|
long |
getLastActiveTime() |
Mind.MentalState |
getState()
Return the state of mind.
|
<T> T |
getThought(java.lang.Class<T> type) |
Thought |
getThought(java.lang.String name) |
java.util.Map<java.lang.String,Thought> |
getThoughts() |
long |
getUnactiveTime()
Returns the amount of time since was last active.
|
void |
incrementState(Mind.MentalState state)
Ensure the minimum state.
|
void |
initialize(java.util.Map<java.lang.String,java.lang.Object> properties)
Initialize any configurable settings from the properties.
|
boolean |
isActive()
Return if in an active state.
|
boolean |
isAsleep()
Return if in an sleep state.
|
boolean |
isBored()
Return if in an bored state.
|
boolean |
isConscious()
Return if in an conscious state.
|
void |
log(java.lang.String message,
java.util.logging.Level level,
java.lang.Object... arguments)
Log the message if the debug level is greater or equal to the level.
|
void |
log(java.lang.Throwable exception)
Log the exception.
|
void |
pool()
Reset state when instance is pooled.
|
void |
processConsciousThoughts()
Process all conscious thoughts, in-order, starting at Consciousness.
|
void |
removeThought(Thought thought) |
void |
setBot(Bot bot)
Set Bot.
|
void |
setLastActiveTime(long lastActiveTime) |
void |
setState(Mind.MentalState state)
Set the state of mind.
|
void |
shutdown() |
java.lang.String |
toString()
Print a useful string representation of the mind.
|
public static long UNACTIVE_TO_ASLEEP
public static long UNACTIVE_TO_BORED
public static java.util.concurrent.ExecutorService threadPool
public Mind.MentalState getState()
public void setState(Mind.MentalState state)
public void incrementState(Mind.MentalState state)
public void decrementState(Mind.MentalState state)
public boolean isConscious()
isConscious
in interface Mind
public boolean isActive()
public boolean isAsleep()
public boolean isBored()
public void log(java.lang.String message, java.util.logging.Level level, java.lang.Object... arguments)
public void log(java.lang.Throwable exception)
public void initialize(java.util.Map<java.lang.String,java.lang.Object> properties)
initialize
in interface Mind
public void pool()
Mind
public void awake()
public void processConsciousThoughts()
public java.util.Map<java.lang.String,Thought> getThoughts()
getThoughts
in interface Mind
public <T> T getThought(java.lang.Class<T> type)
getThought
in interface Mind
public Thought getThought(java.lang.String name)
getThought
in interface Mind
public void addThought(Thought thought)
addThought
in interface Mind
public void removeThought(Thought thought)
removeThought
in interface Mind
public java.lang.String toString()
toString
in class java.lang.Object
public long getUnactiveTime()
public long getLastActiveTime()
public void setLastActiveTime(long lastActiveTime)