|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection
jas.space.Grid
jas.space.DblGrid
public class DblGrid
A bidimensional grid containing double values.
Title: JAS
Description: Java Agent-based Simulation library
Copyright (C) 2002 Michele Sonnessa
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
Constructor Summary | |
---|---|
DblGrid(DblGrid grid)
Create a copy of the given grid. |
|
DblGrid(int xSize,
int ySize)
Create a grid of given size. |
Method Summary | |
---|---|
void |
add(double arg)
Sum the given value to the value of each cell. |
void |
clear()
Set all cells to 0.0 value. |
void |
copyGridTo(DblGrid dm)
Copies the given DblGrid content in this grid. |
void |
copyGridTo(double[] dm)
Copies the double[] matrix content in this grid. |
int |
countObjectsAt(int x,
int y)
Returns the number of objects allocated in cell (x,y). |
java.lang.Object |
get(int x,
int y)
Return a Double object containing the value at given position. |
double |
getDbl(int x,
int y)
Return the value at given position. |
double[] |
getMatrix()
Return the matrix of values representing the grid. |
double |
max()
Get the maximum value stored into the grid. |
double |
mean()
Compute the sample mean value of the values stored in the grid. |
double |
min()
Get the minimum value stored into the grid. |
void |
multiply(double arg)
Multiply the given value to the value of each cell. |
void |
resetTo(double initValue)
Set all cells to the given value. |
void |
set(int x,
int y,
java.lang.Object obj)
Set the given value at given position. |
void |
setDbl(int x,
int y,
double value)
Set the given value at given position. |
int |
size()
Return the size of the grid. |
double |
sum()
Sum the value of each cell. |
void |
swapPositions(int x1,
int y1,
int x2,
int y2)
Swap the content of the (x1, y1) and (x2, y2) cells of the grid. |
double |
variance()
Compute the sample variance value of the values stored in the grid. |
Methods inherited from class jas.space.Grid |
---|
boundX, boundY, equals, getMooreNeighborsPositions, getVonNeumannNeighborsPositions, getXSize, getYSize, gridIterator, iterator, reflectX, reflectY, torusX, torusY, toString |
Methods inherited from class java.util.AbstractCollection |
---|
add, addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Collection |
---|
hashCode |
Constructor Detail |
---|
public DblGrid(DblGrid grid)
grid
- The source grid.public DblGrid(int xSize, int ySize)
xSize
- The width of the grid.ySize
- The height of the grid.Method Detail |
---|
public void add(double arg)
arg
- The value to be added.public void clear()
clear
in interface java.util.Collection
clear
in class Grid
public void copyGridTo(DblGrid dm)
dm
- The source DblGrid to be copied.public void copyGridTo(double[] dm)
dm
- The source matrix to be copied.public int countObjectsAt(int x, int y)
Grid
countObjectsAt
in class Grid
x
- The x coordinate.y
- The y coordinate.public java.lang.Object get(int x, int y)
get
in class Grid
x
- The x coordinate. WARNING: No bounds checking for fast access.y
- The y coordinate. WARNING: No bounds checking for fast access.
public double getDbl(int x, int y)
x
- The x coordinate. WARNING: No bounds checking for fast access.y
- The y coordinate. WARNING: No bounds checking for fast access.
public double[] getMatrix()
public double max()
public double mean()
public double min()
public void multiply(double arg)
arg
- The value to be multiplyed.public void resetTo(double initValue)
initValue
- The value to put into each cell.public void set(int x, int y, java.lang.Object obj)
set
in class Grid
x
- The x coordinate. WARNING: No bounds checking for fast access.y
- The y coordinate. WARNING: No bounds checking for fast access.obj
- An object wrapper for a number class.
It is possible to pass Interger, Double, Float or Long values.public void setDbl(int x, int y, double value)
x
- The x coordinate. WARNING: No bounds checking for fast access.y
- The y coordinate. WARNING: No bounds checking for fast access.value
- A double value to put at x,y position.public int size()
size
in interface java.util.Collection
size
in class Grid
public double sum()
public void swapPositions(int x1, int y1, int x2, int y2)
swapPositions
in class Grid
x1
- The x coordinate for the first cell.y1
- The y coordinate for the first cell.x2
- The x coordinate for the second cell.y2
- The y coordinate for the second cell.public double variance()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |