Class Space3D
- java.lang.Object
-
- jadex.commons.SimplePropertyObject
-
- jadex.commons.meta.TypedPropertyObject
-
- jadex.extension.envsupport.environment.SynchronizedPropertyObject
-
- jadex.extension.envsupport.environment.AbstractEnvironmentSpace
-
- jadex.extension.envsupport.environment.space3d.Space3D
-
- All Implemented Interfaces:
jadex.application.IExtensionInstance
,IPropertyObject
,ITypedPropertyObject
,IEnvironmentSpace
- Direct Known Subclasses:
ContinuousSpace3D
,Grid3D
public abstract class Space3D extends AbstractEnvironmentSpace
General 3D space.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jadex.extension.envsupport.environment.AbstractEnvironmentSpace
AbstractEnvironmentSpace.AtomicCounter
-
-
Field Summary
Fields Modifier and Type Field Description protected IVector3
areasize
Area size.static java.lang.String
BORDER_RELAXED
Border relaxed mode.static java.lang.String
BORDER_STRICT
Border strict mode.static java.lang.String
BORDER_TORUS
Border torus behavior.static java.lang.String
PROPERTY_BORDER
The constant for the border property.static java.lang.String
PROPERTY_POSITION
The constant for the position property.-
Fields inherited from class jadex.extension.envsupport.environment.AbstractEnvironmentSpace
actionlist, actions, avatarmappings, classloader, config, dataconsumers, dataproviders, dataviewmappings, exta, fetcher, ia, initfutures, initialavatars, listeners, objectidcounter, objecttypes, objecttypesMeta, observercenters, perceptgenerators, perceptlist, perceptprocessors, percepttypes, pfetcher, processes, processtypes, spaceobjects, spaceobjectsbyowner, spaceobjectsbytype, taskidcounter, tasktypes, views, zombieobjects
-
Fields inherited from class jadex.extension.envsupport.environment.SynchronizedPropertyObject
monitor
-
Fields inherited from class jadex.commons.SimplePropertyObject
pcs, properties
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IVector3
adjustPosition(IVector3 pos)
Calculate a position according to the space borders.IVector1
calculateDistance(IVector1 dx, IVector1 dy, IVector1 dz)
Calculate the distance in the space.IVector3
getAreaSize()
Returns the size of the simulated area.java.lang.String
getBorderMode()
Get the border mode.IVector1
getDistance(IVector1 pos1, IVector1 pos2, boolean isx)
Get the distance between two coordinates (x or y).IVector1
getDistance(IVector3 pos1, IVector3 pos2)
Get the distance between three positions.ISpaceObject
getNearestObject(IVector3 position, IVector1 maxdist, java.lang.String type)
Returns the nearest object to the given position within a maximum distance from the position.java.util.Set
getNearObjects(IVector3 position, IVector1 maxdist)
Retrieve all objects in the distance for a positionjava.util.Set
getNearObjects(IVector3 position, IVector1 maxdist, IFilter filter)
Retrieve all objects in the distance for a positionjava.util.Set
getNearObjects(IVector3 position, IVector1 maxdist, java.lang.String type)
Retrieve all objects in the distance for a positionIVector3
getRandomPosition(IVector3 distance)
Retrieves a random position within the simulation area with a minimum distance from the edge.java.lang.Object[]
getSpaceObjects()
Get all space objects.void
initSpaceObject(ISpaceObject ret)
Init an object in this space.void
setAreaSize(IVector3 areasize)
Set the area size.void
setPosition(java.lang.Object id, IVector3 pos)
Set the position of an object.-
Methods inherited from class jadex.extension.envsupport.environment.AbstractEnvironmentSpace
addAvatarMappings, addDataConsumer, addDataProvider, addDataView, addDataViewMapping, addEnvironmentListener, addInitFuture, addInitialAvatar, addObjectTaskType, addPerceptGenerator, addPerceptProcessor, addPerceptType, addSpaceAction, addSpaceObjectType, addSpaceProcessType, addTaskListener, cancelSpaceAction, componentAdded, componentRemoved, createAvatar, createObjectTask, createPercept, createSpaceObject, createSpaceObjectZombie, createSpaceProcess, destroySpaceObject, fireEnvironmentEvent, fireObjectEvent, getAvatar, getAvatar, getAvatarMapping, getAvatars, getClassLoader, getComponentActionList, getComponents, getComponentType, getDataConsumer, getDataConsumers, getDataProvider, getDataView, getDataViews, getExternalAccess, getFetcher, getOwner, getPerceptList, getPerceptType, getProcesses, getProperty, getSpaceAction, getSpaceObject, getSpaceObject0, getSpaceObjectsByType, getSpaceObjectsCollection, getSpaceObjectType, getSpaceProcess, getSpaceProcessNames, getViews, init, initSpace, mergeProperties, mergeProperties, performSpaceAction, performSpaceAction, removeAvatarMappings, removeDataView, removeEnvironmentListener, removeObjectTask, removeObjectTaskType, removePerceptGenerator, removePerceptProcessor, removePerceptType, removeSpaceAction, removeSpaceObjectType, removeSpaceProcess, removeSpaceProcessType, removeTaskListener, setFetcher, setInitData, setOwner, terminate, waitForTask
-
Methods inherited from class jadex.extension.envsupport.environment.SynchronizedPropertyObject
addPropertyChangeListener, getMonitor, getPropertyNames, hasProperty, removePropertyChangeListener, setProperty
-
Methods inherited from class jadex.commons.meta.TypedPropertyObject
getMetaData, getMetaDatas
-
Methods inherited from class jadex.commons.SimplePropertyObject
getProperties, setProperties, toString
-
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, hasProperty, setProperty
-
-
-
-
Field Detail
-
PROPERTY_POSITION
public static final java.lang.String PROPERTY_POSITION
The constant for the position property.- See Also:
- Constant Field Values
-
PROPERTY_BORDER
public static final java.lang.String PROPERTY_BORDER
The constant for the border property.- See Also:
- Constant Field Values
-
BORDER_STRICT
public static final java.lang.String BORDER_STRICT
Border strict mode.- See Also:
- Constant Field Values
-
BORDER_RELAXED
public static final java.lang.String BORDER_RELAXED
Border relaxed mode.- See Also:
- Constant Field Values
-
BORDER_TORUS
public static final java.lang.String BORDER_TORUS
Border torus behavior.- See Also:
- Constant Field Values
-
areasize
protected IVector3 areasize
Area size.
-
-
Constructor Detail
-
Space3D
protected Space3D(IVector3 areasize)
Initializes the 3D-Space.- Parameters:
spaceexecutor
- executor for the spaceactionexecutor
- executor for component actionsareasize
- the size of the 2D area
-
-
Method Detail
-
getAreaSize
public IVector3 getAreaSize()
Returns the size of the simulated area.- Returns:
- size of the simulated area
-
setAreaSize
public void setAreaSize(IVector3 areasize)
Set the area size.- Parameters:
areasize
- The area size.
-
getBorderMode
public java.lang.String getBorderMode()
Get the border mode.- Returns:
- the border_mode
-
initSpaceObject
public void initSpaceObject(ISpaceObject ret)
Init an object in this space.- Overrides:
initSpaceObject
in classAbstractEnvironmentSpace
-
setPosition
public void setPosition(java.lang.Object id, IVector3 pos)
Set the position of an object.- Parameters:
id
- The object id.pos
- The object position.
-
getDistance
public IVector1 getDistance(IVector3 pos1, IVector3 pos2)
Get the distance between three positions.- Parameters:
pos1
- The first position.pos2
- The second position.pos3
- The third position.
-
getDistance
public IVector1 getDistance(IVector1 pos1, IVector1 pos2, boolean isx)
Get the distance between two coordinates (x or y).- Parameters:
pos1
- The first position.pos2
- The second position.
-
calculateDistance
public IVector1 calculateDistance(IVector1 dx, IVector1 dy, IVector1 dz)
Calculate the distance in the space.- Parameters:
dx
- The distance in x.dy
- The distance in y.dz
- The distance in z.- Returns:
- The distance according to the distance metrics of the space.
-
adjustPosition
public IVector3 adjustPosition(IVector3 pos)
Calculate a position according to the space borders.
-
getRandomPosition
public IVector3 getRandomPosition(IVector3 distance)
Retrieves a random position within the simulation area with a minimum distance from the edge.- Parameters:
distance
- minimum distance from the edge, null or zero for no distance
-
getNearestObject
public ISpaceObject getNearestObject(IVector3 position, IVector1 maxdist, java.lang.String type)
Returns the nearest object to the given position within a maximum distance from the position.- Parameters:
position
- position the object should be nearest tomaxdist
- maximum distance from the position, use null for unlimited distance- Returns:
- nearest object's ID or null if none is found
-
getNearObjects
public java.util.Set getNearObjects(IVector3 position, IVector1 maxdist)
Retrieve all objects in the distance for a position- Parameters:
position
-distance
-- Returns:
- The near objects.
-
getNearObjects
public java.util.Set getNearObjects(IVector3 position, IVector1 maxdist, java.lang.String type)
Retrieve all objects in the distance for a position- Parameters:
position
-distance
-- Returns:
- The near objects.
-
getNearObjects
public java.util.Set getNearObjects(IVector3 position, IVector1 maxdist, IFilter filter)
Retrieve all objects in the distance for a position- Parameters:
position
-distance
-- Returns:
- The near objects.
-
getSpaceObjects
public java.lang.Object[] getSpaceObjects()
Get all space objects.- Returns:
- All space objects.
-
-