public class Environment
extends java.lang.Object
Execution sequence:
Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.ExecutorService |
executor |
Constructor and Description |
---|
Environment()
creates an environment class with the default number of threads in the pool
|
Environment(int n)
creates an environment class with n threads to execute actions required by the agents
|
Modifier and Type | Method and Description |
---|---|
void |
addPercept(Literal per)
Adds a perception for all agents
|
void |
addPercept(java.lang.String agName,
Literal... per)
Adds a perception for a specific agent
|
void |
clearAllPercepts()
Clears all perception (from common list and individual perceptions)
|
void |
clearPercepts()
Clears the list of global percepts
|
void |
clearPercepts(java.lang.String agName)
Clears the list of percepts of a specific agent
|
java.util.List<Literal> |
consultPercepts(java.lang.String agName)
Returns a copy of the perception for an agent.
|
boolean |
containsPercept(Literal per)
Returns true if the list of common percepts contains the perception per.
|
boolean |
containsPercept(java.lang.String agName,
Literal per) |
boolean |
executeAction(java.lang.String agName,
Structure act)
Executes an action on the environment.
|
EnvironmentInfraTier |
getEnvironmentInfraTier() |
java.util.logging.Logger |
getLogger() |
java.util.List<Literal> |
getPercepts(java.lang.String agName)
Returns percepts for an agent.
|
void |
informAgsEnvironmentChanged(java.util.Collection<java.lang.String> agents)
Deprecated.
use version with String... parameter
|
void |
informAgsEnvironmentChanged(java.lang.String... agents) |
void |
init(java.lang.String[] args)
Called before the MAS execution with the args informed in
.mas2j project, the user environment could override it.
|
boolean |
isRunning() |
boolean |
removePercept(Literal per)
Removes a perception from the common perception list
|
boolean |
removePercept(java.lang.String agName,
Literal per)
Removes a perception for an agent
|
int |
removePerceptsByUnif(Literal per)
Removes all percepts from the common perception list that unifies with per.
|
int |
removePerceptsByUnif(java.lang.String agName,
Literal per)
Removes from an agent perception all percepts that unifies with per.
|
void |
scheduleAction(java.lang.String agName,
Structure action,
java.lang.Object infraData)
Called by the agent infrastructure to schedule an action to be
executed on the environment
|
void |
setEnvironmentInfraTier(EnvironmentInfraTier je)
Sets the infrastructure tier of the environment (saci, jade, centralised, ...)
|
void |
stop()
Called just before the end of MAS execution, the user
environment could override it.
|
public Environment(int n)
public Environment()
public void init(java.lang.String[] args)
public void stop()
public boolean isRunning()
public void setEnvironmentInfraTier(EnvironmentInfraTier je)
public EnvironmentInfraTier getEnvironmentInfraTier()
public java.util.logging.Logger getLogger()
public void informAgsEnvironmentChanged(java.util.Collection<java.lang.String> agents)
public void informAgsEnvironmentChanged(java.lang.String... agents)
public java.util.List<Literal> getPercepts(java.lang.String agName)
public java.util.List<Literal> consultPercepts(java.lang.String agName)
public void addPercept(Literal per)
public boolean removePercept(Literal per)
public int removePerceptsByUnif(Literal per)
public void clearPercepts()
public boolean containsPercept(Literal per)
public void addPercept(java.lang.String agName, Literal... per)
public boolean removePercept(java.lang.String agName, Literal per)
public int removePerceptsByUnif(java.lang.String agName, Literal per)
public boolean containsPercept(java.lang.String agName, Literal per)
public void clearPercepts(java.lang.String agName)
public void clearAllPercepts()
public void scheduleAction(java.lang.String agName, Structure action, java.lang.Object infraData)
public boolean executeAction(java.lang.String agName, Structure act)