Package repast.simphony.valueLayer
Class ContinuousValueLayer
- java.lang.Object
-
- repast.simphony.valueLayer.ContinuousValueLayer
-
- All Implemented Interfaces:
ValueLayer
public class ContinuousValueLayer extends Object implements ValueLayer
A continuous value layer. Each point in the space is accessed via double x, y, z, ... n coordinates and contains some numeric value.- Author:
- Eric Tatara
-
-
Field Summary
Fields Modifier and Type Field Description protected double
defaultValue
protected boolean
dense
protected Dimensions
dims
protected Map<NdPoint,Double>
locationMap
protected String
name
protected PointTranslator
translator
-
Constructor Summary
Constructors Constructor Description ContinuousValueLayer(String name, boolean dense, double... dimensions)
Creates a ContinuousValueLayer with the specified name, density, and dimensions.ContinuousValueLayer(String name, boolean dense, PointTranslator translator, double... dimensions)
Creates a ContinuousValueLayer with the specified name, density, translator, and dimensions.ContinuousValueLayer(String name, double... dimensions)
Creates a continuous value layer withe specified name and dimensions.ContinuousValueLayer(String name, double defaultValue, boolean dense, double... dimensions)
Creates a ContinuousValueLayer with the specified name, density, defaultValue and dimensions.ContinuousValueLayer(String name, double defaultVal, boolean dense, PointTranslator translator, double... dimensions)
Creates a ContinuousValueLayer with the specified name, density, defaultValue, translator, and dimensions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
get(double... coordinates)
Gets a value given the specified coordinates.Dimensions
getDimensions()
Gets the dimensions of this value layer.protected double[]
getLocation(double... location)
String
getName()
Gets the name of this value layer.PointTranslator
getPointTranslator()
Retrieves the rule being used for controlling what happens at or beyond the borders of the value layer.void
set(double value, double... coordinate)
Sets the specified point to the specified value.void
setPointTranslator(PointTranslator rule)
Sets the rule to use for controlling what happens at or beyond the borders of the value layer.
-
-
-
Field Detail
-
name
protected String name
-
dims
protected Dimensions dims
-
defaultValue
protected double defaultValue
-
dense
protected boolean dense
-
translator
protected PointTranslator translator
-
-
Constructor Detail
-
ContinuousValueLayer
public ContinuousValueLayer(String name, double... dimensions)
Creates a continuous value layer withe specified name and dimensions.- Parameters:
name
- the name of the value layerdimensions
- the dimensions of the value layer
-
ContinuousValueLayer
public ContinuousValueLayer(String name, boolean dense, double... dimensions)
Creates a ContinuousValueLayer with the specified name, density, and dimensions. The default value of every cell in the grid will be 0. The default border behavior is strict.- Parameters:
name
- the name of the value layerdense
- dummy argumentdimensions
- the dimension of the value layer
-
ContinuousValueLayer
public ContinuousValueLayer(String name, double defaultValue, boolean dense, double... dimensions)
Creates a ContinuousValueLayer with the specified name, density, defaultValue and dimensions. The default border behavior is strict.- Parameters:
name
- the name of the value layerdefaultValue
- the default value that a location will contain if it has not been set yetdense
- dummy argumentdimensions
- the dimension of the value layer
-
ContinuousValueLayer
public ContinuousValueLayer(String name, boolean dense, PointTranslator translator, double... dimensions)
Creates a ContinuousValueLayer with the specified name, density, translator, and dimensions. The default value of every cell in the grid will be 0.- Parameters:
name
- the name of the value layerdense
- dummy argumenttranslator
- the translator useddimensions
- the dimension of the value layer
-
ContinuousValueLayer
public ContinuousValueLayer(String name, double defaultVal, boolean dense, PointTranslator translator, double... dimensions)
Creates a ContinuousValueLayer with the specified name, density, defaultValue, translator, and dimensions.- Parameters:
name
- the name of the value layerdefaultVal
- the default value that each cell will contain if it has not been set yetdense
- dummy argumenttranslator
- the translator useddimensions
- the dimension of the value layer
-
-
Method Detail
-
get
public double get(double... coordinates)
Gets a value given the specified coordinates. This assumes the coordinates are double x, y, z, n values.- Specified by:
get
in interfaceValueLayer
- Parameters:
coordinates
- the coordinates used to return the value.- Returns:
- a value given the specified coordinates.
-
set
public void set(double value, double... coordinate)
Sets the specified point to the specified value.- Parameters:
value
- the new value of the cellcoordinate
- the coordinate of the cell whose value we want to set
-
getLocation
protected double[] getLocation(double... location)
-
getName
public String getName()
Gets the name of this value layer.- Specified by:
getName
in interfaceValueLayer
- Returns:
- the name of this value layer.
-
getDimensions
public Dimensions getDimensions()
Gets the dimensions of this value layer.- Specified by:
getDimensions
in interfaceValueLayer
- Returns:
- the dimensions of this value layer.
-
getPointTranslator
public PointTranslator getPointTranslator()
Retrieves the rule being used for controlling what happens at or beyond the borders of the value layer.- Returns:
- the rule for handling out of bounds coordinates
-
setPointTranslator
public void setPointTranslator(PointTranslator rule)
Sets the rule to use for controlling what happens at or beyond the borders of the value layer.- Parameters:
rule
- the rule for handling out of bounds coordinates
-
-