|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdd.sim.SimObject
dd.sim.Layer
A collection of related pieces of information. This simulation map is (conceptually) split into multiple layers. Each layer has attributes related to some aspect of the simulation, such as population, traffic, or land use. Layers span over multiple cells, so the layer is used to query a map to retrieve relevant cells or obtain characteristics of cells.
Because of the tight connection between Maps and Layers, it is often
unnecessary to create Layer objects directly. Instead, a layer can be
created and associated with a map by calling the
Map.createLayer()
method. This has the
advantage of ensuring that every map cell shares the same layer, rather
than creating a different layer object for each cell, which could
potentially cause model inconsistencies.
Field Summary |
Fields inherited from class dd.sim.SimObject |
attributes |
Constructor Summary | |
Layer()
Creates a new unnamed layer. |
|
Layer(java.lang.String layerName)
Creates a new named layer. |
Method Summary | |
java.util.Collection |
cellsWithValuesInRange(java.lang.String attributeName,
float minValue,
float maxValue)
Finds all cells with attributes between a minimum and maximum value. |
MapCell |
cellWithMaxValue(java.lang.String attributeName)
Finds a cell with the maximum value for some attribute. |
MapCell |
cellWithMaxValue(java.lang.String attributeName,
java.util.Collection cells)
Searches a subset of cells for a cell with the maximum value for some attribute. |
MapCell |
cellWithMinValue(java.lang.String attributeName)
Finds a cell with the minimum value for some attribute. |
MapCell |
cellWithMinValue(java.lang.String attributeName,
java.util.Collection cells)
Searches a subset of cells for a cell with the minimum value for some attribute. |
MapCell |
cellWithValue(java.lang.String attributeName,
int value)
Finds the first cell with attribute equal to the specified value. |
float |
getAttribute(java.lang.String attributeName,
MapCell cell)
Queries this layer for an attribute associated with a specified cell. |
java.lang.String |
getName()
Returns the name of this layer. |
java.lang.Object |
getObjectAttribute(java.lang.String attributeName,
MapCell cell)
Queries this layer for an attribute associated with a specified cell. |
protected void |
setCells(MapCell[][] mapCells)
Associates this layer with cells from a map. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Layer()
public Layer(java.lang.String layerName)
Note that if a layer is created directly, it must be added to the map and linked to the map's cells.
layerName
- name of this layerMap.createLayer(String)
Method Detail |
public java.lang.String getName()
protected void setCells(MapCell[][] mapCells)
mapCells
- cells to which the layer was addedpublic float getAttribute(java.lang.String attributeName, MapCell cell)
getObjectAttribute
method,
which shares the same variables.
This call is equivalent to calling
cell.getAttribute(attributeName, layer)
.
attributeName
- name of the attribute to be queriedcell
- cell with which the attribute is associated
java.util.NoSuchElementException
- if there is no attribute with that name
associated with that cell.public java.lang.Object getObjectAttribute(java.lang.String attributeName, MapCell cell)
attributeName
- name of the attribute to be queriedcell
- cell with which the attribute is associated
null
if the attribute does not existpublic MapCell cellWithMinValue(java.lang.String attributeName)
attributeName
- attribute to query
public MapCell cellWithMaxValue(java.lang.String attributeName)
attributeName
- attribute to query
public MapCell cellWithMinValue(java.lang.String attributeName, java.util.Collection cells)
attributeName
- attribute to querycells
- cells (subset of the map) to search
public MapCell cellWithMaxValue(java.lang.String attributeName, java.util.Collection cells)
attributeName
- attribute to querycells
- cells (subset of the map) to search
public java.util.Collection cellsWithValuesInRange(java.lang.String attributeName, float minValue, float maxValue)
attributeName
- attribute to queryminValue
- lower end of rangemaxValue
- upper end of range
public MapCell cellWithValue(java.lang.String attributeName, int value)
cellsWithValuesInRange
method instead.
attributeName
- attribute to queryvalue
- value to search for
null
if no such cell is found.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |