public abstract class Agent extends Object
Modifier and Type | Field and Description |
---|---|
protected Set<apltk.interpreter.data.LogicBelief> |
beliefs |
protected Set<apltk.interpreter.data.LogicGoal> |
goals |
Constructor and Description |
---|
Agent(String name,
String team)
Initializes an agent with a given name.
|
Modifier and Type | Method and Description |
---|---|
void |
addBelief(apltk.interpreter.data.LogicBelief belief) |
void |
addGoal(apltk.interpreter.data.LogicGoal goal) |
void |
broadcastBelief(apltk.interpreter.data.LogicBelief belief)
Sends a message to all agents of the team.
|
protected void |
clearBeliefs() |
void |
clearGoals() |
boolean |
containsBelief(apltk.interpreter.data.LogicBelief belief) |
protected boolean |
containsGoal(apltk.interpreter.data.LogicGoal goal) |
static Agent |
createAgentFromClass(String agentName,
String team,
String agentClass)
Yields an instance of a specified agent-class with a given name.
|
boolean |
equals(Object obj) |
LinkedList<apltk.interpreter.data.LogicBelief> |
getAllBeliefs(String predicate)
Yields all beliefs from the belief base that have a specific
predicate.
|
protected Collection<eis.iilang.Percept> |
getAllPercepts()
Yields all percepts that are currently available.
|
Collection<apltk.interpreter.data.LogicBelief> |
getBeliefBase()
Yields the belief-base of the agent.
|
static eis.EnvironmentInterfaceStandard |
getEnvironmentInterface()
Yields the environment-interface that all agents access.
|
Collection<apltk.interpreter.data.LogicGoal> |
getGoalBase()
Yields the goal-base of the agent.
|
protected Collection<apltk.interpreter.data.Message> |
getMessages()
Gets all messages that were sent to the agent.
|
String |
getName()
Yields the name of the agent.
|
String |
getTeam()
Yields the team of the agent.
|
abstract void |
handlePercept(eis.iilang.Percept p)
This method is called if the environment-interface sends a
percept as a notification.
|
int |
hashCode() |
protected void |
println(Object obj)
Prints an arbitrary object, e.g. a String, to the standard-out.
|
void |
removeBeliefs(String predicate)
Removes all beliefs from the belief-base that have a given predicate.
|
protected void |
removeGoals(String predicate)
Removes all goals that have a given predicate.
|
void |
sendMessage(apltk.interpreter.data.Belief belief,
String receiver)
Sends a message to a specific agent in the team.
|
static void |
setEnvironmentInterface(eis.EnvironmentInterfaceStandard theEI)
Sets the environment-interface for all agents in this process.
|
abstract eis.iilang.Action |
step()
Executes one step of the agent.
|
protected Set<apltk.interpreter.data.LogicBelief> beliefs
protected Set<apltk.interpreter.data.LogicGoal> goals
public String getName()
public String getTeam()
public static Agent createAgentFromClass(String agentName, String team, String agentClass)
agentName
- is the name of the agentteam
- is the team of the agentagentClass
- is the fully-qualified name of the agent-class to-be-loadedpublic static void setEnvironmentInterface(eis.EnvironmentInterfaceStandard theEI)
theEI
- is the environment-interfacepublic static eis.EnvironmentInterfaceStandard getEnvironmentInterface()
public abstract eis.iilang.Action step()
protected final void println(Object obj)
obj
- public final Collection<apltk.interpreter.data.LogicBelief> getBeliefBase()
public final Collection<apltk.interpreter.data.LogicGoal> getGoalBase()
protected Collection<eis.iilang.Percept> getAllPercepts()
protected final Collection<apltk.interpreter.data.Message> getMessages()
public final void sendMessage(apltk.interpreter.data.Belief belief, String receiver)
msg
- the message to be sentreceiver
- the recipient of the messagepublic final void broadcastBelief(apltk.interpreter.data.LogicBelief belief)
msg
- the message to be broadcastedpublic abstract void handlePercept(eis.iilang.Percept p)
getAllPercepts
method which
yields all percepts.p
- the percept to be handledpublic LinkedList<apltk.interpreter.data.LogicBelief> getAllBeliefs(String predicate)
predicate
- the given predicatepublic void removeBeliefs(String predicate)
predicate
- the given predicateprotected void removeGoals(String predicate)
predicate
- the given predicatepublic void addBelief(apltk.interpreter.data.LogicBelief belief)
public void addGoal(apltk.interpreter.data.LogicGoal goal)
public boolean containsBelief(apltk.interpreter.data.LogicBelief belief)
protected boolean containsGoal(apltk.interpreter.data.LogicGoal goal)
protected void clearBeliefs()
public void clearGoals()
Copyright © 2013. All Rights Reserved.