Class Environment
- java.lang.Object
-
- jadex.bdi.examples.marsworld_classic.Environment
-
public class Environment extends java.lang.Object
The environment as singleton.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.ArrayList
agentinfos
The hashtable containing all agent infos.static java.lang.String
CARRY_AGENT
The carry agent type.protected Homebase
homebase
The agents homebase.protected static Environment
instance
The enviroment insstance.static java.lang.String
PRODUCTION_AGENT
The production agent type.static java.lang.String
SENTRY_AGENT
The sentry agent type.protected java.util.ArrayList
targets
The target locations.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
clearInstance()
Clear the singleton instance.static Environment
createInstance(IClockService clock)
Create a new instance.AgentInfo[]
getAgentInfos()
Get all agent infos.Homebase
getHomebase()
Get the homebase.static Environment
getInstance()
Get the environment.Target
getTarget(Location loc)
Get a target for a location.Target
getTarget(java.lang.String id)
Get the target for the target-id.Target[]
getTargets()
The the info for an agentTarget[]
getTargetsNear(Location loc, double tolerance)
Get all targets near a position.void
setAgentInfo(AgentInfo agentinfo)
The the info for an agent.
-
-
-
Field Detail
-
CARRY_AGENT
public static final java.lang.String CARRY_AGENT
The carry agent type.- See Also:
- Constant Field Values
-
PRODUCTION_AGENT
public static final java.lang.String PRODUCTION_AGENT
The production agent type.- See Also:
- Constant Field Values
-
SENTRY_AGENT
public static final java.lang.String SENTRY_AGENT
The sentry agent type.- See Also:
- Constant Field Values
-
agentinfos
protected java.util.ArrayList agentinfos
The hashtable containing all agent infos.
-
targets
protected java.util.ArrayList targets
The target locations.
-
instance
protected static Environment instance
The enviroment insstance.
-
homebase
protected Homebase homebase
The agents homebase.
-
-
Method Detail
-
getInstance
public static Environment getInstance()
Get the environment.- Returns:
- The environment.
-
createInstance
public static Environment createInstance(IClockService clock)
Create a new instance.
-
clearInstance
public static void clearInstance()
Clear the singleton instance.
-
getTargets
public Target[] getTargets()
The the info for an agent. / public void addTarget(Location target) { this.targets.put(target.getLocation(), target); } /** Get all targets.
-
getTargetsNear
public Target[] getTargetsNear(Location loc, double tolerance)
Get all targets near a position.
-
getHomebase
public Homebase getHomebase()
Get the homebase.
-
setAgentInfo
public void setAgentInfo(AgentInfo agentinfo)
The the info for an agent.
-
getAgentInfos
public AgentInfo[] getAgentInfos()
Get all agent infos.
-
getTarget
public Target getTarget(Location loc)
Get a target for a location. WARNING: Method does not check if more than one target is near.
-
getTarget
public Target getTarget(java.lang.String id)
Get the target for the target-id.
-
-