public class Environment extends Agent
Modifier and Type | Class and Description |
---|---|
class |
Environment.EnvironmentOptions
Extends the options data structure to save the bounds of the room
environment automatically (if the agent is persistent).
|
(package private) class |
Environment.SimulationPanel
The specialized JPanel to handle painting and mouse events.
|
TransientAgent.NewAgentLispCommand
AbstractProcess.Subthread
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
(package private) Set<PhysObject> |
allPhysObjects
The list of all PhysObjects that are to displayed in the environment.
|
Rectangle2D |
bounds
The borders of the environment
|
private static Environment |
instance
The singleton instance of this class
|
private static CasaLispOperator |
IROBOT_ENV__DELETE
Lisp operator: (iRobot-env.delete)
Sends a message to the LAC requesting the registered agents. |
private static CasaLispOperator |
IROBOT_ENV__DELETE_ALL
Lisp operator: (iRobot-env.delete-all)
Sends a message to the LAC requesting the registered agents. |
private static CasaLispOperator |
IROBOT_ENV__NEW
Lisp operator: (iRobot-env.new)
Sends a message to the LAC requesting the registered agents. |
private static CasaLispOperator |
IROBOT_ENV__NEW_BOUNDS
Lisp operator: (iRobot-env.new-bounds)
Sends a message to the LAC requesting the registered agents. |
private static CasaLispOperator |
IROBOT_ENV__SET
Lisp operator: (iRobot-env.set)
Sends a message to the LAC requesting the registered agents. |
private static CasaLispOperator |
IROBOT_ENV__SHOW
Lisp operator: (iRobot-env.show)
Lists all the objects in the environment. |
private JPanel |
layeredPane
The pane in which drawing takes place.
|
long |
startTime |
long |
tickCount |
static long |
tickIntervalNanoS |
private PhysObject |
wallE |
private PhysObject |
wallN |
private PhysObject |
wallS |
private PhysObject |
wallW |
agentConstructorComplete, properties
cacheKB, CDInvitedTo, CDinvitee, conversationData, defaultOntologyClassName, DEFER_ACTION, DROP_ACTION, kBase, ListOfArgs, ontologyEngineCreateMethod, ontologyEngineLoadMethod, policies, policiesAlwaysApply, policiesLastResort, primaryUI, proxy, UIs, usingProxy
huntForPort, initParams, ontology, ontologyShared, options, securityFilter, trace, TRACE_MONITOR, TRACE_OFF, TRACE_ON, TRACE_TO_FILE, TRACE_UNDEFINED, uniqueThreadName, waitingForAgentToStart
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
Environment(ParamsMap params,
AgentUI ui)
A normal agent constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
createAndShowGUI(String name)
Put up the room environment animation window.
|
private void |
draw(Graphics2D graph)
Draw the room environment in the window by first scaling it to fit the window
and then calling each object's
PhysObject.draw(Graphics2D) method in
turn. |
private Status |
executeObjectOptions(ParamsMap params,
AgentUI ui)
Utility method used by object initiation.
|
static boolean |
exits() |
Set<PhysObject> |
findObjectIn(Area oarea)
Finds any object that intersects with the given area.
|
(package private) Set<PhysObject> |
findOverlap(PhysObject o,
Shape oshape)
Finds any object that intersect with the parameter object.
|
Rectangle2D |
getBounds() |
static Environment |
getInstance() |
PhysObject |
getObject(String name)
Finds the first object with the given name.
|
Environment.EnvironmentOptions |
getOptions()
Returns a reference to this object's
ProcessOptions object. |
protected Point2D.Double |
getScaleFactor() |
protected void |
initializeThread(ParamsMap params,
AgentUI ui)
Called when the agent is read to run.
|
void |
invalidate(PhysObject o)
The objects let this class know they have changed through this method.
|
protected ProcessOptions |
makeOptions()
Factory method to make a new options object.
|
protected void |
pendingFinishRun()
This is called when the agent is shutting down.
|
protected void |
queue() |
void |
registerObject(PhysObject o)
Registers an object for later painting an processing by placing it in
allPhysObjects . |
void |
resetRobotLocations() |
void |
setBounds(Rectangle2D bounds)
Sets (or resets) the bounds of the room environment.
|
void |
tickTime() |
(package private) void |
unregisterObject(PhysObject o)
Unregisters an object by removing it from
allPhysObjects |
destroyDataObject, finalize, getAgentOptions, getBooleanProperty, getCASAFilename, getCreateDate, getDataObject, getDataObjectInputStream, getDataObjectOutputStream, getDoubleProperty, getFloatProperty, getIntegerProperty, getLongProperty, getStringProperty, hasProperty, initializeAfterRegistered, isPersistent, main, makeDefaultGUI, makeDefaultInternalFrame, putDataObject, putDataObject, readPersistent, ready, realizeAgentBehaviourFromOptions, removeProperty, setBooleanProperty, setDoubleProperty, setFloatProperty, setIntegerProperty, setLongProperty, setOptions, setPersistent, setStringProperty, updateOptions, writePersistent
abclEval, abclEval, abclEval, accept_deleteCD, accept_exit, accept_forward_message, accept_LAC_closing, accept_new_MenuItem, accept_update, acceptDefault, addConversation, addJoinedCooperationDomain, addMembers, addSubscribeEvents, assembleDefault, assert_, assert_, authorizedByProxy, authorizeMessage, chooseSC, concludeDefault, consider_execute, consider_invite_to_cd, consider_new_MenuItem, consider_ping, consider_query_if, consider_query_ref, considerDefault, createCasaLispOperators, dispatchMsgHandlerMethod, doAddObserver, doAdvertise, doCDGetHistory_sync, doCDGetMembers, doCDPutData, doCDSubscribeMembership, doFindInstances_sync, doGetCooperationDomains, doGetOnology, doInviteToCD, doJoinCD, doPing_sync, doPing, doRegisterAgentInstance, doRegisterAgentInstance, doResolveURL, doSearchYP, doUnadvertise, doUnregisterAgentInstance, doUnregisterAgentType, doWithdrawCD, evaluateDefault, evesdrop, executeCommand, findFileResourcePath, findFileResourcePath, getAgentForThread, getAlwaysApplyPolicies, getBanner, getCachedKnowledgeBase, getChosenCommitment, getCommitmentProcessor, getConversation, getConversations, getConversationsReport, getDefaultBanner, getDefFileSystemLocations, getEventForThread, getField, getInstancesFound, getJoinedCooperationDomain, getJoinedCooperationDomains, getKnowledgeBase, getLACURL, getLastResortPolicies, getMembers, getMsgForThread, getObjectsForThread, getOntology, getOntologyEngine, getOntologyFileSuffix, getPolicies, getPrimaryUI, getProxy, getSCStore, getSerializedOntology, getStrategy, getStrategyGUI, getSubscribeEvents, getSubscribeEvents, getTermsFromContent, getUI, getUIForThread, getUIs, getUnfulfilledSocialCommitments, getUnfulfilledSocialCommitments, handleErrorReplies, handleEvent, handleLACClosing, hasActiveCommitments, hasConversation, hasStrategyGUI, initializePolicies, initJADE, initUI, isEventQueueReady, isRegistered, isRegisteredWithLAC, isStoppable, isTrusted, isTrusted, isUsingProxy, kb_get_value, makeDefaultInterface, makeDefaultTextInterface, monitorDefault, notifySendingMessage, optionsToString, parseJADENode, pendingFinishRun_unregisterAgentInstance, pendingFinishRun_withdrawFromAllCDs, perform_execute, perform_FIPAStyle, perform_get_name, perform_get_ontology, perform_invite_to_cd, perform_method_call, perform_query_if, perform_query_if, perform_query_ref, perform_query_ref, performDefault, processCommitment, processCommitments, processObserverNotification, putExtendedOntology, putPolicy, putPolicyAlwaysApply, putPolicyLastResort, putReplacementOntology, putUI, query_ref, query_toString, query, queryIf, queryRef_toIntegerList, queryRef_toString, queryRef_toStringList, queryRef_toTermList, queryRef, queryRef, queryRefAIDs, queryRefURLs, querywithFilter, recursiveParent, recursivePermutations, release_execute, release_FIPAStyle, release_get_agents_registered, release_get_agents_running, release_get_members, release_get_ontology, release_join_cd, release_ping, release_query_if, release_query_ref, release_resolve_url, release_unregister_agentType, release_unregister_instance, release_withdraw_cd, releaseDefault, removeConversation, removeCooperationDomains, removeJoinedCooperationDomain, removeSubscribeEvents, requestInstances, resolveConnectException, retrieveReturnedData, saveReturnedData, searchOntology, searchOntology1, setBanner, setCommitmentProcessor, setField, setInstancesFound, setOntology, shouldDoExecuteRequest, template_handleNewOntologyInfo, update, updateConversationProtocolType, verifyCD, verifyDefault, verifyMessage
addObserver, addObserver, addObserver, addObserver, addTraceTags, addTransformation, bump, clearAllTraceTags, closePort, compareTo, countObservers, defer, defer, deleteObserver, deleteObserver, deleteObservers, dequeueEvent, equals, eventBufferLoopBody, eventBufferLoopPeriodic, eventQueuePeek, existed, exit, finishRun, fixupMessage, getAgent, getAgentName, getEventQueue, getInitParams, getNewMessage, getNewMessage, getPort, getSocketServer, getTrace, getTraceTags, getTransformationFor, getUniqueRequestID, getURL, getUseAckProtocol, getUsePriority, hasChanged, hasOpenPort, in, initializeConstructor, initializeURL, isA, isA, isA, isA, isAAct, isAAct, isAgentThread, isAPerformative, isAPerformative, isExiting, isInitialized, isLoggingTag, isObserveMessages, isPaused, isThisMyAddress, isTracing, loadClass, makeSubthread, makeSubthread, makeTraceParam, notifyObservers, notifyObservers, notifyObserversWithNoArg, notifyObserversWithTop, out, println, println, println, println, println, queueEvent, queueEventIf, removeTraceTags, resetRuntimeOptionsFromCommandLine, resetSecurityPackage, resetTraceOptions, revTransform, revTransform, run, sendMessage, sendMessage, sendMessageAndWait, sendQueryAndWait, sendRequestAndWait, sendRequestAndWait, setAllTraceTags, setObserveMessages, setPause, setTraceTags, setTracing, setURL, setUseAckProtocol, setUsePriority, startSocketServer, startTraceMonitor, step, transform, transform, unhandledMessage
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
getClass, hashCode, notify, notifyAll, wait, wait, wait
doAdvertise, doCDGetHistory_sync, doCDGetMembers, doCDPutData, doFindInstances_sync, doGetCooperationDomains, doGetOnology, doInviteToCD, doJoinCD, doPing_sync, doPing, doRegisterAgentInstance, doRegisterAgentInstance, doSearchYP, doUnadvertise, doUnregisterAgentInstance, doUnregisterAgentType, doWithdrawCD, executeCommand, getInstancesFound, getJoinedCooperationDomains, getLACURL, getMembers, getOntology, getSerializedOntology, getStrategyGUI, hasStrategyGUI, isAAct, isInitialized, isRegistered, makeDefaultInterface, putExtendedOntology, putReplacementOntology, putUI, release_get_ontology, removeCooperationDomains, requestInstances
addObserver, addObserver, closePort, deleteObserver, deleteObserver, exit, getAgentName, getName, getNewMessage, getPort, getStrategy, getTrace, getUniqueRequestID, getURL, getUseAckProtocol, hasOpenPort, isA, isAPerformative, isExiting, isLoggingTag, isStoppable, isTracing, println, println, println, sendMessage, setTracing, setUseAckProtocol, startTraceMonitor
addObserver, addObserver, countObservers, deleteObservers, hasChanged, notifyObservers, notifyObservers, notifyObserversWithNoArg, notifyObserversWithTop
abclEval, abclEval, abclEval, addTransformation, bump, chooseSC, defer, dequeueEvent, dispatchMsgHandlerMethod, evesdrop, getKnowledgeBase, getName, getSCStore, getSubscribeEvents, getTransformationFor, getUniqueRequestID, getURL, getUseAckProtocol, isA, isA, isA, isA, isAPerformative, isAPerformative, isLoggingTag, notifyObservers, println, println, println, queueEvent, queueEventIf, revTransform, revTransform, sendMessage, transform, transform
public static final long tickIntervalNanoS
public long tickCount
public long startTime
Set<PhysObject> allPhysObjects
public Rectangle2D bounds
private static Environment instance
private JPanel layeredPane
private PhysObject wallN
private PhysObject wallS
private PhysObject wallE
private PhysObject wallW
private static final CasaLispOperator IROBOT_ENV__NEW
private static final CasaLispOperator IROBOT_ENV__DELETE
private static final CasaLispOperator IROBOT_ENV__DELETE_ALL
private static final CasaLispOperator IROBOT_ENV__SHOW
private static final CasaLispOperator IROBOT_ENV__SET
private static final CasaLispOperator IROBOT_ENV__NEW_BOUNDS
protected void queue()
public void tickTime()
public static Environment getInstance() throws Exception
Exception
- if the Environment can't be created.Environment(ParamsMap, AgentUI)
public static boolean exits()
getInstance()
, this method will never create
an instance.public void registerObject(PhysObject o) throws InstantiationException
allPhysObjects
. If the object is animated, it checks to make sure
it doesn't intersect an existing object.o
- the object to registerInstantiationException
- if the object is an animate and there's already some object in its location.void unregisterObject(PhysObject o)
allPhysObjects
o
- the object to be removedSet<PhysObject> findOverlap(PhysObject o, Shape oshape)
o
- the object to determine any overlapsoshape
- the proposed new shape (position) of the new object.public Set<PhysObject> findObjectIn(Area oarea)
oarea
- an Area
to look for objects inpublic PhysObject getObject(String name)
name
- The name of the object to look for.protected Point2D.Double getScaleFactor()
private void draw(Graphics2D graph)
PhysObject.draw(Graphics2D)
method in
turn.graph
- the graphics surface to draw onpublic void invalidate(PhysObject o)
o
- the object that has changed.private void createAndShowGUI(String name)
name
- The text of for the title barprotected void initializeThread(ParamsMap params, AgentUI ui)
initializeThread
in class TransientAgent
casa.Agent#init()
public Rectangle2D getBounds()
public void setBounds(Rectangle2D bounds)
bounds
- the bounds to setpublic void resetRobotLocations()
private Status executeObjectOptions(ParamsMap params, AgentUI ui) throws Exception
params
- the map of params from the command lineui
- the agent's UI.Exception
- if the Environment instance can't be foundprotected void pendingFinishRun()
pendingFinishRun
in class Agent
AbstractProcess.pendingFinishRun()
protected ProcessOptions makeOptions()
AbstractProcess
makeOptions
in class Agent
public Environment.EnvironmentOptions getOptions()
AbstractProcess
ProcessOptions
object.getOptions
in interface PolicyAgentInterface
getOptions
in interface ProcessInterface
getOptions
in interface TransientAgentInterface
getOptions
in class Agent
ProcessOptions
object.