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 SimpleValueFetcher
fetcher
The fetcher.protected java.lang.Object
id
The object's ID.protected AbstractEnvironmentSpace
space
The space.protected MultiCollection<java.lang.Object,IResultListener<?>>
tasklisteners
The task listeners.protected java.util.Map
tasks
The object's tasks.protected java.lang.String
typename
The 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 void
addTask(IObjectTask task)
Adds a new task for the object.void
addTaskListener(java.lang.Object taskid, IResultListener listener)
Add a result listener to a task.void
clearTasks()
Removes all tasks from the object.java.lang.Object
getId()
Get the objects id.java.util.Map
getProperties()
Bean accessor.java.lang.Object
getProperty(java.lang.String name)
Returns a property.IObjectTask
getTask(java.lang.Object id)
Get a specific task.java.util.Collection
getTasks()
Returns all tasks of the object for introspection.java.lang.String
getType()
Returns the type of the object.boolean
hasProperty(java.lang.String name)
Test if has a property.void
removeTask(java.lang.Object taskid, java.lang.Exception e)
Removes a task from the object.void
removeTaskListener(java.lang.Object taskid, IResultListener listener)
Remove a result listener from a task.void
setId(java.lang.Object id)
Set the id of the object.void
setProperty(java.lang.String name, java.lang.Object value)
Only for debugging.void
setType(java.lang.String type)
Set the type of the object.java.lang.String
toString()
Get the string representation.void
updateObject(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:
getProperty
in interfaceIPropertyObject
- Overrides:
getProperty
in 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:
setProperty
in interfaceIPropertyObject
- Overrides:
setProperty
in classSynchronizedPropertyObject
- Parameters:
name
- name of the propertyvalue
- value of the property
-
getId
public java.lang.Object getId()
Get the objects id.- Specified by:
getId
in 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:
getType
in 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:
getProperties
in classSimplePropertyObject
-
hasProperty
public boolean hasProperty(java.lang.String name)
Test if has a property.- Specified by:
hasProperty
in interfaceIPropertyObject
- Overrides:
hasProperty
in classSynchronizedPropertyObject
- Parameters:
name
- the name of the property to test- Returns:
true
if and only if the property exists
-
toString
public java.lang.String toString()
Get the string representation.- Overrides:
toString
in classSimplePropertyObject
- Returns:
- The string representation.
-
-