|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ascape.model.space.CollectionSpace
org.ascape.model.space.Singleton
public class Singleton
A space with treates itself as its only member. This provides agents with a way to have single rules implemented upon them and to support views.
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 | |
---|---|
Singleton()
Construct a new Singleton. |
Method Summary | |
---|---|
double |
calculateDistance(Coordinate origin,
Coordinate target)
Returns the shortest distance between one agent and another. |
void |
construct()
Normally, create the basic strucutre of the space. |
Location |
findRandom()
Returns an agent randomly selected from the collection. |
Coordinate |
findRandomCoordinate()
Returns a coordinate randomly selected from the collection's space. |
Location[] |
getLocations()
Returns all agents in the space as an array. |
int |
getSize()
Returns the number of members of this space. |
boolean |
isMutable()
Is the context mutable, that is, can it change its structure at runtime? Returns true for this collection. |
java.util.Iterator |
iterator()
Returns an iterator across all agents in this context. |
void |
moveAway(Location origin,
Coordinate target,
double distance)
Moves an agent toward the specified agent. |
void |
moveToward(Location origin,
Coordinate target,
double distance)
Moves an agent toward the specified agent. |
void |
populate()
Normally, populates the space with instances of its protoype agent. |
ResetableIterator |
safeIterator()
Returns a context iterator across all objects in this context. |
ResetableIterator |
safeIterator(int start,
int limit)
Safe iterator. |
RandomIterator |
safeRandomIterator()
Returns a context iterator across all agents in random order. |
void |
setExtent(Coordinate extent)
Sets the size of the context. |
java.lang.String |
toString()
Returns a string representing this space. |
Methods inherited from class org.ascape.model.space.CollectionSpace |
---|
add, add, addAll, calculateDistance, clear, clone, conditionalIterator, conditionalIterator, contains, containsAll, countWithin, createOrder, createSpatialConditional, deleteSweep, filter, find, findMaximum, findMaximum, findMaximumWithin, findMinimum, findMinimum, findMinimumWithin, findNearest, findNearest, findRandom, findRandom, findRandom, findRandomWithin, findWithin, get, getContext, getExtent, getGeometry, getRandom, hasWithin, initialize, isDeleteSweepNeeded, isEmpty, isPeriodic, iteratorCount, iteratorToList, newLocation, newLocation, randomInRange, randomInRange, randomIs, randomizeOrder, randomToLimit, remove, removeAll, retainAll, safeIterators, set, setContext, setExtent, setGeometry, setPeriodic, setRandom, setSize, size, toArray, toArray, toList, withinIterator |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Collection |
---|
equals, hashCode |
Constructor Detail |
---|
public Singleton()
Method Detail |
---|
public int getSize()
getSize
in interface Space
getSize
in class CollectionSpace
public void construct()
construct
in interface Space
construct
in class CollectionSpace
public void populate()
populate
in interface Space
populate
in class CollectionSpace
public java.util.Iterator iterator()
CollectionSpace
iterator
in interface java.lang.Iterable
iterator
in interface java.util.Collection
iterator
in class CollectionSpace
public ResetableIterator safeIterator(int start, int limit)
Space
safeIterator
in interface Space
safeIterator
in class CollectionSpace
start
- the startlimit
- the limit
public ResetableIterator safeIterator()
CollectionSpace
safeIterator
in interface Space
safeIterator
in class CollectionSpace
public RandomIterator safeRandomIterator()
CollectionSpace
safeRandomIterator
in interface Space
safeRandomIterator
in class CollectionSpace
public Location[] getLocations()
public 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
public java.lang.String toString()
toString
in class java.lang.Object
public Location findRandom()
CollectionSpace
findRandom
in interface Space
findRandom
in class CollectionSpace
public Coordinate findRandomCoordinate()
CollectionSpace
findRandomCoordinate
in interface Space
findRandomCoordinate
in class CollectionSpace
public void setExtent(Coordinate extent)
CollectionSpace
setExtent
in interface Space
setExtent
in class CollectionSpace
extent
- a coordinate at the maximum extentpublic final boolean isMutable()
CollectionSpace
isMutable
in interface Space
isMutable
in class CollectionSpace
|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |