|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.ascape.model.space.CollectionSpace org.ascape.model.space.SubCollection
public abstract class SubCollection
A space collection that is part of another space collection. Any agents added to this collection will also be added to the super collection, and any agents removed from this collection will be removed from the super collection. Note that agents removed directly from the super collection will not be removed from this collection.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.ascape.model.space.CollectionSpace |
---|
CollectionSpace.ClosestDataPoint, CollectionSpace.ConditionalIterator, CollectionSpace.CSIterator, CollectionSpace.CSMutableIterator, CollectionSpace.ListMutableRandomIterator, CollectionSpace.ListRandomIterator, CollectionSpace.MutableSubIterator, CollectionSpace.SubIterator |
Field Summary |
---|
Fields inherited from class org.ascape.model.space.CollectionSpace |
---|
collection, ESTIMATED_MAXIMUM_SIZE, extent, geometry |
Constructor Summary | |
---|---|
SubCollection()
Constructs a sub-collection. |
|
SubCollection(CoordinateDiscrete extent)
Constructs a sub-collection. |
Method Summary | |
---|---|
boolean |
add(java.lang.Object o,
boolean isParent)
Adds the supplied object (agent) to this list at the specified location and to end of the super list. |
boolean |
addAll(java.util.Collection c)
Inserts all of the agents in the specified collection at the location specified in this list, and at the end of the super list. |
double |
calculateDistance(Coordinate origin,
Coordinate target)
Returns the shortest distance between one agent and the other, in the context of the superscape. |
void |
clear()
Removes all agents from the space, and all members of this space from the super collection. |
Space |
getSuperSpace()
Returns the super collection for this sub collection, that is, the collection defined to contain a superset of this space's agents. |
void |
moveAway(Location origin,
Coordinate target,
double distance)
Moves an agent toward the specified agent in the context of the superscape. |
void |
moveToward(Location origin,
Coordinate target,
double distance)
Moves an agent toward the specified agent in the context of the superscape. |
void |
populate()
Populates the space and its super collection with clones of the prototype agent. |
boolean |
remove(java.lang.Object o)
Removes the supplied object (agent) from this collection and its superlist. |
boolean |
removeAll(java.util.Collection c)
Removes all of the agnets contained in the collection from this space collection and its super space collection. |
boolean |
retainAll(java.util.Collection c)
Retains only the elements in the space that are in the specified collection. |
void |
setSuperSpace(Space superSpace)
Sets the super collection for this sub collection, that is, the collection defined to contain a superset of this space's agents. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Collection |
---|
equals, hashCode |
Constructor Detail |
---|
public SubCollection()
public SubCollection(CoordinateDiscrete extent)
extent
- a coordinate describing the size of this spaceMethod Detail |
---|
public void populate()
populate
in interface Space
populate
in class CollectionSpace
public boolean add(java.lang.Object o, boolean isParent)
add
in interface Space
add
in class CollectionSpace
isParent
- should this space be made the parent space of the agent?o
- the o
java.lang.ClassCastException
- if the object is not an instance of agentpublic boolean remove(java.lang.Object o)
remove
in interface java.util.Collection
remove
in class CollectionSpace
o
- the agent to be removed
public boolean addAll(java.util.Collection c)
addAll
in interface java.util.Collection
addAll
in class CollectionSpace
c
- collection whose agents are to be added to the space
public boolean removeAll(java.util.Collection c)
removeAll
in interface java.util.Collection
removeAll
in class CollectionSpace
c
- collection whose agents are to be added to the space
public boolean retainAll(java.util.Collection c)
retainAll
in interface java.util.Collection
retainAll
in class CollectionSpace
c
- collection whose agents are to be retained in the space
public void clear()
clear
in interface java.util.Collection
clear
in class CollectionSpace
public Space getSuperSpace()
getSuperSpace
in interface SubSpace
public void setSuperSpace(Space superSpace)
setSuperSpace
in interface SubSpace
superSpace
- the collection to assign as super setpublic void moveToward(Location origin, Coordinate target, double distance)
moveToward
in interface Space
moveToward
in class CollectionSpace
origin
- the agent movingtarget
- the agent's targetdistance
- the distance to movepublic void moveAway(Location origin, Coordinate target, double distance)
moveAway
in interface Space
moveAway
in class CollectionSpace
origin
- the agent movingtarget
- the agent's targetdistance
- the distance to movepublic double calculateDistance(Coordinate origin, Coordinate target)
calculateDistance
in interface Space
calculateDistance
in class CollectionSpace
origin
- the starting celltarget
- the ending cell
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |