Class SpaceObject
- java.lang.Object
-
- jadex.commons.SimplePropertyObject
-
- jadex.commons.meta.TypedPropertyObject
-
- jadex.extension.envsupport.environment.SynchronizedPropertyObject
-
- jadex.extension.envsupport.environment.SpaceObject
-
- All Implemented Interfaces:
IPropertyObject,ITypedPropertyObject,ISpaceObject
public class SpaceObject extends SynchronizedPropertyObject implements ISpaceObject
Default implementation of a space object.
-
-
Field Summary
Fields Modifier and Type Field Description protected SimpleValueFetcherfetcherThe fetcher.protected java.lang.ObjectidThe object's ID.protected AbstractEnvironmentSpacespaceThe space.protected MultiCollection<java.lang.Object,IResultListener<?>>tasklistenersThe task listeners.protected java.util.MaptasksThe object's tasks.protected java.lang.StringtypenameThe object's typename.-
Fields inherited from class jadex.extension.envsupport.environment.SynchronizedPropertyObject
monitor
-
Fields inherited from class jadex.commons.SimplePropertyObject
pcs, properties
-
Fields inherited from interface jadex.extension.envsupport.environment.ISpaceObject
PROPERTY_OWNER
-
-
Constructor Summary
Constructors Constructor Description SpaceObject(java.lang.Object id, MObjectType type, java.util.Map properties, java.util.List tasks, java.lang.Object monitor, AbstractEnvironmentSpace space)Creates a new EnvironmentObject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTask(IObjectTask task)Adds a new task for the object.voidaddTaskListener(java.lang.Object taskid, IResultListener listener)Add a result listener to a task.voidclearTasks()Removes all tasks from the object.java.lang.ObjectgetId()Get the objects id.java.util.MapgetProperties()Bean accessor.java.lang.ObjectgetProperty(java.lang.String name)Returns a property.IObjectTaskgetTask(java.lang.Object id)Get a specific task.java.util.CollectiongetTasks()Returns all tasks of the object for introspection.java.lang.StringgetType()Returns the type of the object.booleanhasProperty(java.lang.String name)Test if has a property.voidremoveTask(java.lang.Object taskid, java.lang.Exception e)Removes a task from the object.voidremoveTaskListener(java.lang.Object taskid, IResultListener listener)Remove a result listener from a task.voidsetId(java.lang.Object id)Set the id of the object.voidsetProperty(java.lang.String name, java.lang.Object value)Only for debugging.voidsetType(java.lang.String type)Set the type of the object.java.lang.StringtoString()Get the string representation.voidupdateObject(IEnvironmentSpace space, long progress, IClockService clock)Updates the object to the current time.-
Methods inherited from class jadex.extension.envsupport.environment.SynchronizedPropertyObject
addPropertyChangeListener, getMonitor, getPropertyNames, removePropertyChangeListener
-
Methods inherited from class jadex.commons.meta.TypedPropertyObject
getMetaData, getMetaDatas
-
Methods inherited from class jadex.commons.SimplePropertyObject
setProperties
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jadex.commons.IPropertyObject
getPropertyNames
-
Methods inherited from interface jadex.commons.meta.ITypedPropertyObject
getMetaData, getMetaDatas
-
-
-
-
Field Detail
-
id
protected java.lang.Object id
The object's ID.
-
typename
protected java.lang.String typename
The object's typename.
-
tasks
protected java.util.Map tasks
The object's tasks.
-
tasklisteners
protected MultiCollection<java.lang.Object,IResultListener<?>> tasklisteners
The task listeners.
-
fetcher
protected SimpleValueFetcher fetcher
The fetcher.
-
space
protected AbstractEnvironmentSpace space
The space.
-
-
Constructor Detail
-
SpaceObject
public SpaceObject(java.lang.Object id, MObjectType type, java.util.Map properties, java.util.List tasks, java.lang.Object monitor, AbstractEnvironmentSpace space)Creates a new EnvironmentObject.- Parameters:
objectId- the object's IDtypename- the object's typeproperties- initial properties (may be null)propertiesMeta- the meta data of the propertiestasks- initial task list (may be null)
-
-
Method Detail
-
getProperty
public java.lang.Object getProperty(java.lang.String name)
Returns a property.- Specified by:
getPropertyin interfaceIPropertyObject- Overrides:
getPropertyin classSynchronizedPropertyObject- Parameters:
name- name of the property- Returns:
- the property
-
setProperty
public void setProperty(java.lang.String name, java.lang.Object value)Only for debugging.- Specified by:
setPropertyin interfaceIPropertyObject- Overrides:
setPropertyin classSynchronizedPropertyObject- Parameters:
name- name of the propertyvalue- value of the property
-
getId
public java.lang.Object getId()
Get the objects id.- Specified by:
getIdin interfaceISpaceObject- Returns:
- The object id.
-
setId
public void setId(java.lang.Object id)
Set the id of the object.
-
getType
public java.lang.String getType()
Returns the type of the object.- Specified by:
getTypein interfaceISpaceObject- Returns:
- the type
-
setType
public void setType(java.lang.String type)
Set the type of the object.
-
addTask
public void addTask(IObjectTask task)
Adds a new task for the object.- Parameters:
task- new task
-
removeTask
public void removeTask(java.lang.Object taskid, java.lang.Exception e)Removes a task from the object.- Parameters:
task- The task.
-
getTasks
public java.util.Collection getTasks()
Returns all tasks of the object for introspection.- Returns:
- all tasks of the object
-
getTask
public IObjectTask getTask(java.lang.Object id)
Get a specific task.- Parameters:
id- The task id.- Returns:
- The task.
-
clearTasks
public void clearTasks()
Removes all tasks from the object.
-
addTaskListener
public void addTaskListener(java.lang.Object taskid, IResultListener listener)Add a result listener to a task. The result will be the task id. If the task is already finished, the listener will be notified.
-
removeTaskListener
public void removeTaskListener(java.lang.Object taskid, IResultListener listener)Remove a result listener from a task.
-
updateObject
public void updateObject(IEnvironmentSpace space, long progress, IClockService clock)
Updates the object to the current time. time the current time- Parameters:
progress- The time that has passed according to the environment executor.clock- The clock service.
-
getProperties
public java.util.Map getProperties()
Bean accessor. For serializing a space object, replace dynamic expressions with current values.- Overrides:
getPropertiesin classSimplePropertyObject
-
hasProperty
public boolean hasProperty(java.lang.String name)
Test if has a property.- Specified by:
hasPropertyin interfaceIPropertyObject- Overrides:
hasPropertyin classSynchronizedPropertyObject- Parameters:
name- the name of the property to test- Returns:
trueif and only if the property exists
-
toString
public java.lang.String toString()
Get the string representation.- Overrides:
toStringin classSimplePropertyObject- Returns:
- The string representation.
-
-