|
![]() |
|||||||||
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.Discrete
org.ascape.model.space.Array
org.ascape.model.space.ListBase
public abstract class ListBase
A one-dimensional, fixed-size, collection of agents providing services described for space.
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.Array |
---|
CACHE_RESULTS |
Fields inherited from class org.ascape.model.space.Discrete |
---|
performanceWarning |
Fields inherited from class org.ascape.model.space.CollectionSpace |
---|
collection, ESTIMATED_MAXIMUM_SIZE, extent, geometry |
Constructor Summary | |
---|---|
ListBase()
Constructs a space array. |
|
ListBase(CoordinateDiscrete extent)
Constructs a space array of provided extent, populated with clones of provided agent. |
Method Summary | |
---|---|
void |
add(CoordinateDiscrete coordinate,
java.lang.Object o)
Adds the supplied object (assumed to be an agent) to this list. |
void |
add(int index,
java.lang.Object o)
Adds the supplied object (assumed to be an agent) to this list. |
void |
add(int index,
java.lang.Object o,
boolean isParent)
Adds the supplied object (agent) to this list. |
boolean |
add(java.lang.Object o,
boolean isParent)
Adds the supplied object (agent) to this list. |
boolean |
addAll(int index,
java.util.Collection c)
Inserts all of the agents in the specified collection at the location specified. |
double |
calculateDistance(Coordinate origin,
Coordinate target)
Returns the shortest distance between one Location and another. |
void |
coordinateSweep()
Walks through each agent, setting the agent's coordinates. |
Node |
findCellAway(Node origin,
Node target)
Returns the cell within immediate neighborhood furthest away from the requested cell. |
Node |
findCellToward(Node origin,
Node target)
Returns the next cell within immediate neighborhood toward the requested cell. |
Node |
findFirstMatchInRank(Coordinate origin,
Conditional condition,
int rank)
Returns a random element in the supplied rank that matches the supplied condition, null if no matches. |
int |
findNearestMatchRank(Coordinate origin,
Conditional condition,
boolean includeOrigin)
Returns the nearest rank that includes a cell which matches the supplied condition, -1 if no matches. |
int |
findNearestMatchRank(Coordinate origin,
Conditional condition,
boolean includeOrigin,
double maximumDistance)
Returns the nearest rank that includes a cell which matches the supplied condition, -1 if no matches. |
Location |
findRandomMatchInRank(Coordinate origin,
Conditional condition,
int rank)
Returns a random element in the supplied rank that matches the supplied condition, null if no matches. |
java.util.List |
findWithinImpl(Coordinate origin,
boolean includeSelf,
double distance)
Returns cells that are near the provided cell. |
Node |
get(CoordinateDiscrete coordinate)
Returns the agents at the specified index. |
java.lang.Object |
get(int index)
Returns the agents at the specified index. |
int |
indexOf(java.lang.Object o)
Returns the index in this list of the first occurrence of the agent. |
boolean |
isCoordinateSweepNeeded()
Is a coordinate location sweep needed for this space? Intended for internal purposes. |
int |
lastIndexOf(java.lang.Object o)
Returns the index in this list of the last occurrence of the agent. |
java.util.ListIterator |
listIterator()
Returns a list iterator across all agents in this space. |
java.util.ListIterator |
listIterator(int index)
Returns a list iterator across all agents in this space, beginning at the specified index. |
void |
populate()
Populates the space with clones of the prototype agent. |
java.lang.Object |
remove(CoordinateDiscrete coordinate)
Removes the agent at the specified coordinate from this list. |
java.lang.Object |
remove(int index)
Removes the agent at the specified position from this list. |
boolean |
remove(java.lang.Object o)
Removes the supplied object (agent) from this list. |
Node |
set(int index,
Location o,
boolean isParent)
Sets the agent at the specified coordinate to the supplied agent. |
java.lang.Object |
set(int index,
java.lang.Object o)
Sets the agent at the specified coordinate to the supplied agent. |
void |
setGeometry(Geometry geometry)
Sets the geometry of this space. |
java.util.List |
subList(int fromIndex,
int toIndex)
Returns a view of a sublist of this list between the specified indices. |
Methods inherited from class org.ascape.model.space.Array |
---|
findNearest, findWithin, replace, swap |
Methods inherited from class org.ascape.model.space.CollectionSpace |
---|
add, addAll, calculateDistance, clear, clone, conditionalIterator, conditionalIterator, construct, contains, containsAll, countWithin, createOrder, createSpatialConditional, deleteSweep, filter, find, findMaximum, findMaximum, findMaximumWithin, findMinimum, findMinimum, findMinimumWithin, findNearest, findRandom, findRandom, findRandom, findRandom, findRandomCoordinate, findRandomWithin, get, getContext, getExtent, getGeometry, getRandom, hasWithin, initialize, isDeleteSweepNeeded, isEmpty, isMutable, isPeriodic, iterator, iteratorCount, iteratorToList, moveAway, moveToward, newLocation, newLocation, randomInRange, randomInRange, randomIs, randomizeOrder, randomToLimit, removeAll, retainAll, safeIterator, safeIterator, safeIterators, safeRandomIterator, set, setContext, setExtent, setExtent, setPeriodic, setRandom, setSize, size, toArray, toArray, toList, withinIterator |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.List |
---|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, removeAll, retainAll, size, toArray, toArray |
Constructor Detail |
---|
public ListBase()
public ListBase(CoordinateDiscrete extent)
extent
- a coordinate describing the size of this spaceMethod Detail |
---|
public void populate()
populate
in interface Space
populate
in class CollectionSpace
public void add(int index, java.lang.Object o)
add
in interface java.util.List
index
- location to insert the new agento
- the agent to addpublic void add(int index, java.lang.Object o, boolean isParent)
index
- location to insert the new agento
- the agent to addisParent
- should this space be made the parent space of the agent?
java.lang.ClassCastException
- if the object is not an instance of agentpublic boolean add(java.lang.Object o, boolean isParent)
add
in interface Space
add
in class CollectionSpace
o
- the agent to addisParent
- should this space be made the parent space of the agent?
java.lang.ClassCastException
- if the object is not an instance of agentpublic void add(CoordinateDiscrete coordinate, java.lang.Object o)
coordinate
- the coordinate to insert the new agent ato
- the agent to addpublic boolean addAll(int index, java.util.Collection c)
addAll
in interface java.util.List
index
- the location at which to place the agentsc
- collection whose agents are to be added to the space
public java.lang.Object remove(CoordinateDiscrete coordinate)
coordinate
- coordinate of the agent to delete
public java.lang.Object remove(int index)
remove
in interface java.util.List
index
- location of the agent to delete
public boolean remove(java.lang.Object o)
remove
in interface java.util.Collection
remove
in interface java.util.List
remove
in class CollectionSpace
o
- the agent to be removed
public java.lang.Object set(int index, java.lang.Object o)
set
in interface java.util.List
index
- the lcoation to add the agent ato
- the agent to add
public Node set(int index, Location o, boolean isParent)
index
- the location to add the agent ato
- the agent to addisParent
- should this space be made the parent space of the agent?
public void setGeometry(Geometry geometry)
setGeometry
in class CollectionSpace
geometry
- the basic geometry of this spacepublic int indexOf(java.lang.Object o)
indexOf
in interface java.util.List
o
- the agent to search for.
public int lastIndexOf(java.lang.Object o)
lastIndexOf
in interface java.util.List
o
- the agent to search for.
public double calculateDistance(Coordinate origin, Coordinate target)
CollectionSpace
calculateDistance
in interface Space
calculateDistance
in class Discrete
origin
- one Locationtarget
- another Location
public java.util.List findWithinImpl(Coordinate origin, boolean includeSelf, double distance)
findWithinImpl
in class Array
origin
- the coordinate to find cells neardistance
- the distance to form centralCells to return cellsincludeSelf
- should supplied agent be included in the return set
public Node findCellToward(Node origin, Node target)
findCellToward
in class Discrete
origin
- the current celltarget
- the cell that we are moving toward
public Node findCellAway(Node origin, Node target)
findCellAway
in class Discrete
origin
- the current celltarget
- the cell that we are moving toward
public int findNearestMatchRank(Coordinate origin, Conditional condition, boolean includeOrigin)
origin
- the agent to find cells nearcondition
- the condition that found cell must meetincludeOrigin
- should supplied agent (rank 0) be included in the search
public int findNearestMatchRank(Coordinate origin, Conditional condition, boolean includeOrigin, double maximumDistance)
findNearestMatchRank
in class Array
origin
- the agent to find cells nearcondition
- the condition that found cell must meetincludeOrigin
- should supplied agent (rank 0) be included in the searchmaximumDistance
- the maximum distance to search within
public Node findFirstMatchInRank(Coordinate origin, Conditional condition, int rank)
origin
- the agent to find cells nearcondition
- the condition that found cell must meetrank
- the rank to return match in
public Location findRandomMatchInRank(Coordinate origin, Conditional condition, int rank)
findRandomMatchInRank
in class Array
origin
- the agent to find cells nearcondition
- the condition that found cell must meetrank
- the rank to return match in
public java.util.ListIterator listIterator()
listIterator
in interface java.util.List
public java.util.ListIterator listIterator(int index)
listIterator
in interface java.util.List
index
- index of first agent to be returned
public java.util.List subList(int fromIndex, int toIndex)
subList
in interface java.util.List
fromIndex
- the low index (inclusive)toIndex
- the high index (exclusive)
java.lang.IndexOutOfBoundsException
- for an illegal endpoint index value @ see java.util.Listpublic void coordinateSweep()
public boolean isCoordinateSweepNeeded()
public java.lang.Object get(int index)
get
in interface java.util.List
index
- index of the agent to return.
java.lang.IndexOutOfBoundsException
- if the index is out of rangepublic Node get(CoordinateDiscrete coordinate)
coordinate
- location of the agent to return.
java.lang.IndexOutOfBoundsException
- if the index is out of range
|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |