/** * Created with IntelliJ IDEA. * User: rebeccamancy * Date: 26/10/2012 * Time: 12:22 * To change this template use File | Settings | File Templates. */ import java.util.HashMap; /** * Holds the totPatches, x-y locations and carrying capacity of patches, and distance between patches (distance matrix) */ public abstract class Habitat { private int numPatches; /** * Constructor sets up patch sizes and array to hold distances between * @param numPatches total number of patches to include topology */ public Habitat(int numPatches) { this.numPatches = numPatches; } /** * Abstract method: returns the carrying capacity of a given patch * @param patchID patch identifier * @return double containing carrying capacity */ public abstract double getK(int patchID); /** * Abstract method: returns the carrying capacity of a given patch * @return double array containing carrying capacities */ public abstract double[] getK(); /** * Abstract method: returns array of x-y coords in LandscapeHabitat or null otherwise * @param patchID patch identifier * @return double array of length two containing x-y coordinates of patch */ public abstract Point getPatchLoc(int patchID); // GETTERS AND SETTERS + PRINTING // /** * Returns the total number of patches * @return total number of patches in the habitat */ public int getNumPatches() { return this.numPatches; } public void setNumPatches(int numPatches) { this.numPatches = numPatches; } /** * Looks up the distance between two patches in the distances matrix * @param focPatch focal patch * @param othPatch other patch * @return distance */ public abstract double lookupDist(int focPatch, int othPatch ); /** * Sets the distance between two patches in the distance matrix * @param focPatch focal patch * @param othPatch second patch * @param dist distance between patches */ public abstract void setDist(int focPatch, int othPatch, double dist); public abstract String toString(); }