/** * --Copyright notice-- * * Copyright (c) School of Geography, University of Leeds. * http://www.geog.leeds.ac.uk/ * This software is licensed under 'The Artistic License' which can be found at * the Open Source Initiative website at... * http://www.opensource.org/licenses/artistic-license.php * Please note that the optional Clause 8 does not apply to this code. * * The Standard Version source code, and associated documentation can be found at... * [online] http://mass.leeds.ac.uk/ * * * --End of Copyright notice-- * */ /** * Holds environmental data as a raster for the model. * @version 1.0 * @author Andy Evans */ public class Environment { /** Width of environment. */ private int width = 300; /** Height of environment. */ private int height = 200; /** Raster dataset for environment. */ private double[][] data = new double[height][width]; /** * Gets the width, as one might expect. * @return current environment width */ public int getWidth() { return width; } /** * Gets the height, as one might expect. * @return current environment height */ public int getHeight() { return height; } /** * Sets the data array. * @param data 2D data array */ public void setData(double[][] data) { this.data = data; height = data.length; width = data[0].length; } /** * Gets the data array. * @return the 2D data array */ public double[][] getData() { return data; } /** * Mutator method for a single data point. * @param x location across a row * @param y location down a column / row number * @param value value to set at position y,x */ public void setDataValue (int x, int y, double value) { data[y][x] = value; } /** * Accessor method for a single data point. * @param x location across a row * @param y location down a column / row number * @return value at position y,x */ public double getDataValue (int x, int y) { return data[y][x]; } }