public class Community
extends java.lang.Object
Constructor and Description |
---|
Community(Community community)
takes a community object and constructs an identical communiy object, can be seen as a safe and easy alternative to clone()
|
Community(int gridLength,
int dispersalRadius,
int AADispersalRadius,
double KAAProduced,
boolean useStep2,
java.util.ArrayList<Species> speciesList)
Sets up a community.
|
Community(int gridLength,
int dispersalRadius,
int AADispersalRadius,
double KAAProduced,
boolean useStep2,
boolean useSharedInitProp,
double initProp,
boolean useSharedDeathProb,
double deathProb,
boolean use0,
double initProp0,
double cmax0,
double death0,
int inoculateWhen0,
boolean inoculateOverwrite0,
int AA1Kx0,
int AA2Kx0,
int AA3Kx0,
boolean use1,
double initProp1,
double cmax1,
double death1,
int inoculateWhen1,
boolean inoculateOverwrite1,
int AA1Kx1,
int AA2Kx1,
int AA3Kx1,
boolean use2,
double initProp2,
double cmax2,
double death2,
int inoculateWhen2,
boolean inoculateOverwrite2,
int AA1Kx2,
int AA2Kx2,
int AA3Kx2,
boolean use3,
double initProp3,
double cmax3,
double death3,
int inoculateWhen3,
boolean inoculateOverwrite3,
int AA1Kx3,
int AA2Kx3,
int AA3Kx3,
boolean use12,
double initProp12,
double cmax12,
double death12,
int inoculateWhen12,
boolean inoculateOverwrite12,
int AA1Kx12,
int AA2Kx12,
int AA3Kx12,
boolean use23,
double initProp23,
double cmax23,
double death23,
int inoculateWhen23,
boolean inoculateOverwrite23,
int AA1Kx23,
int AA2Kx23,
int AA3Kx23,
boolean use13,
double initProp13,
double cmax13,
double death13,
int inoculateWhen13,
boolean inoculateOverwrite13,
int AA1Kx13,
int AA2Kx13,
int AA3Kx13,
boolean use123,
double initProp123,
double cmax123,
double death123,
int inoculateWhen123,
boolean inoculateOverwrite123,
int AA1Kx123,
int AA2Kx123,
int AA3Kx123)
Sets up a community.
|
Modifier and Type | Method and Description |
---|---|
int |
abundFromProp(double prop)
Takes a proportion of microsites and turns it into an number of microsites.
|
void |
checkForInoculations()
goes through the list of species and checks if it's time for that species to be inoculated.
|
double[] |
finalValue(int numSteps,
boolean reportDensity)
Gives an array of species abundances or densities after a number of time steps.
|
double[] |
finalValueReps(int numSteps,
int numReps,
boolean reportDensity) |
int[] |
getAbundances(boolean reportDensity)
gets the abundance for each species.
|
Environment |
getEnvironment()
Gets the environment, which consists of a grid and that grid's length.
|
int[][] |
getGrid()
Gets the environment grid.
|
int[][] |
getGridWithNames()
Returns a grid where the location of an individual is denoted with its species name as opposed to its grid proxy.
|
java.util.ArrayList<Species> |
getSpeciesList() |
int[][] |
gridFinal(int numSteps)
Gets the environment grid after exacting a specified number of time steps.
|
int[][][] |
gridTimeSeries(int numSteps,
int measureHowOften)
Gives a time series of environment grids.
|
int[][][] |
gridTimeSeries(int start,
int end,
int measureHowOften)
Gives a time series of environment grids.
|
int[][][] |
gridTimeSeriesScatter(int numSteps,
int measureHowOften)
GetGridScatter is identical to getGridTimeSeries, except that it scatters the populations
after every time step.
|
int[][][] |
gridTimeSeriesScatter(int start,
int end,
int measureHowOften)
getGridScatter is identical to getGridTimeSeries, except that it scatters the populations
after every time step.
|
java.lang.String[] |
headerForTimeSeries()
Gives a "header" (aka an array of column names) for the timeSeries method.
|
void |
inoculateInMiddle(int initAbund)
Inoculates all the species into a small area in the middle of the envrionment grid.
|
void |
inoculateSpecies(int speciesListIndex,
boolean overrideOtherCritters)
Randomly places a population on the environment grid.
|
void |
neverInoculate()
Makes sure that no species can be added to the environmment after this method is called.
|
void |
noAA3()
If there are no species that produce amino acid three, then make it so no species need amino acid 3.
|
void |
scatter()
The program scatter randomly mixes up all of the individuals, without changing
the actual population.
|
void |
scatter2()
The program scatter randomly mixes up all of the individuals, without changing
the actual population.
|
void |
setAADispersalRadius(int AADispersalRadius)
Sets a new AADispersalRadius.
|
void |
setDispersalRadius(int dispersalRadius)
Sets a new dispersalRadius.
|
void |
setGrid(int[][] grid)
Replaces the old environment grid with the grid parameter.
|
void |
seTimeStep(int timeStep)
Sets the time step counter.
|
void |
setKAAProduced(double KAAProduced)
Set a new KAAProduced.
|
void |
setSeed(int setHere)
Setting the seed allows simulations to be repeatable.
|
void |
setToStep1()
Tells the simulation to use the time stepping function where amino acid availibility directly affects recruitment.
|
void |
setToStep2()
Tells the simulations to use the time stepping function where amino acid availibility directly affects fecunditiy, i.e.
|
void |
step()
Calls either step1 or step2.
|
void |
step(int numSteps)
Calls either step1 or step2.
|
void |
step1()
Execute one time step where amino acid availibility affects recruitment.
|
void |
step2() |
int[][] |
timeSeries(int numSteps,
int measureHowOften,
boolean reportDensity)
Generates time series data over a specified number of time steps, at a specified resolution.
|
int[][] |
timeSeries(int start,
int end,
int measureHowOften,
boolean reportDensity)
Generates time series data over a specified number of time steps, at a specified resolution.
|
public Community(Community community)
community
- a Community to be copiedpublic Community(int gridLength, int dispersalRadius, int AADispersalRadius, double KAAProduced, boolean useStep2, java.util.ArrayList<Species> speciesList)
gridLength
- the length the square grid environmentdispersalRadius
- the "radius" of a square neighborhood within which propagules can be dispersed. Examples: A value of 1 denotes a 3x3 neighboorhood, A value of 2 denotes a 5x5 neighborhood.AADispersalRadius
- the "radius" of a square neighborhood within which amino acids can be utilized. This parameter is only used in the step2 functionKAAProduced
- the quantity of amino acid that is produced (per type of amino acid) by a single individual. These are distributed evenly between all the neighbors within the dispersalRadius (for step1) or AADispersalRadius (for step2).useStep2
- if false, amino acid availibility affects recruitment. if true, amino acid availibity affects the birth rate of adults.speciesList
- a list of species objects. A species list can be created with the static [MakeSpeciesList.makeSpeciesList(...)], or with the alternative community constructorpublic Community(int gridLength, int dispersalRadius, int AADispersalRadius, double KAAProduced, boolean useStep2, boolean useSharedInitProp, double initProp, boolean useSharedDeathProb, double deathProb, boolean use0, double initProp0, double cmax0, double death0, int inoculateWhen0, boolean inoculateOverwrite0, int AA1Kx0, int AA2Kx0, int AA3Kx0, boolean use1, double initProp1, double cmax1, double death1, int inoculateWhen1, boolean inoculateOverwrite1, int AA1Kx1, int AA2Kx1, int AA3Kx1, boolean use2, double initProp2, double cmax2, double death2, int inoculateWhen2, boolean inoculateOverwrite2, int AA1Kx2, int AA2Kx2, int AA3Kx2, boolean use3, double initProp3, double cmax3, double death3, int inoculateWhen3, boolean inoculateOverwrite3, int AA1Kx3, int AA2Kx3, int AA3Kx3, boolean use12, double initProp12, double cmax12, double death12, int inoculateWhen12, boolean inoculateOverwrite12, int AA1Kx12, int AA2Kx12, int AA3Kx12, boolean use23, double initProp23, double cmax23, double death23, int inoculateWhen23, boolean inoculateOverwrite23, int AA1Kx23, int AA2Kx23, int AA3Kx23, boolean use13, double initProp13, double cmax13, double death13, int inoculateWhen13, boolean inoculateOverwrite13, int AA1Kx13, int AA2Kx13, int AA3Kx13, boolean use123, double initProp123, double cmax123, double death123, int inoculateWhen123, boolean inoculateOverwrite123, int AA1Kx123, int AA2Kx123, int AA3Kx123)
gridLength
- the length the square grid environment.dispersalRadius
- the "radius" of a square neighborhood within which propagules can be dispersed. Examples: A value of 1 denotes a 3x3 neighboorhood, A value of 2 denotes a 5x5 neighborhood.AADispersalRadius
- the "radius" of a square neighborhood within which amino acids can be utilized. This parameter is only used in the step2 function.KAAProduced
- the quantity of amino acid that is produced (per type of amino acid) by a single individuals. These are distributed evenly between all the neighbors within the dispersalRadius (for step1) or AADispersalRadius (for step2).useStep2
- if false, amino acid availibility affects recruitment. if true, amino acid availibity affects the birth rate of adults.speciesList
- a list of species objects. A species list can be created with the static [MakeSpeciesList.makeSpeciesList(...)], or with the alternative community constructor.useSharedInitProp
- if true, then all species are assigned the same initial abundance, and the parameters initProp0, initProp1, ... become irrelevant.initProp
- proportion of microsites occupied by all the species at their inoculation times. Basically, this quantity divided by the number of species gives the proportion of microsites that a species is to hold at inoculation time.useSharedDeathProb
- if true, then all species are assigned the same probability of death, and the parameters deathProb0, deathProb1, ... become irrelevant.deathProb
- if useSharedDeathProb is true, then this is the death probability that is assigned to each species.
note all the following parameters are ended by the number zero. This number denotes the types of amino acids that the species produces. Here, the suffix 0 denotes the cheater-specific parameter while the suffix 123 denotes a generalist-specific parameter.
use0
- if false, then the species is not used in the simulation. All species-specific parameters with the same identifying suffix are null and void.initProp0
- the proportion of microsites that this species is to hold at inoculation time.cmax0
- the maximum birth probability.death0
- the death probability.inoculateWhen0
- at what time step should the species be inoculated into the environment grid.inoculateOverwrite0
- if true, then inoculated individuals can overwrite preexisting individuals. If false, then the inoculated individuals must find an empty microsite. If an individual cannot find a microsite after 500 tries, then it can overwrite heterospecifics. see method: inoculateSpecies.AA1Kx0
- the amino acid 1 requirement. If amino acid availability is less than this quantity, then an individual may be limited by this amino acid.AA2Kx0
- the amino acid 2 requirement. If amino acid availability is less than this quantity, then an individual may be limited by this amino acid.AA3Kx0
- the amino acid 3 requirement. If amino acid availability is less than this quantity, then an individual may be limited by this amino acid.public int abundFromProp(double prop)
prop
- the proportion of micrositesinoculateInMiddle, inoculateSpecies
public void checkForInoculations()
public double[] finalValue(int numSteps, boolean reportDensity)
numSteps
- run for this many time steps before recording abundances/densitiesreportDensity
- if true, return an array of densities. If false, return an array of abundancespublic double[] finalValueReps(int numSteps, int numReps, boolean reportDensity)
public int[] getAbundances(boolean reportDensity)
reportDensity
- if true, then return an array of densitiespublic Environment getEnvironment()
public int[][] getGrid()
public int[][] getGridWithNames()
public java.util.ArrayList<Species> getSpeciesList()
public int[][] gridFinal(int numSteps)
numSteps
- public int[][][] gridTimeSeries(int numSteps, int measureHowOften)
numSteps
- how many time steps the method runs formeasureHowOften
- how often should data be collectedpublic int[][][] gridTimeSeries(int start, int end, int measureHowOften)
start
- run this many time steps before recording any dataend
- how many time steps elapse in total before the method endsmeasureHowOften
- how often should data be collectedpublic int[][][] gridTimeSeriesScatter(int numSteps, int measureHowOften)
numSteps
- how many steps should the method run formeasureHowOften
- how often should data be collectedpublic int[][][] gridTimeSeriesScatter(int start, int end, int measureHowOften)
start
- run this many time steps before startingend
- how many time steps elapse in total before the method endsmeasureHowOften
- how often should data be collectedpublic java.lang.String[] headerForTimeSeries()
public void inoculateInMiddle(int initAbund)
initAbund
- the cumulative number of individuals that will be inoculatedpublic void inoculateSpecies(int speciesListIndex, boolean overrideOtherCritters)
speciesListIndex
- the speciesList index of the species that is to be inoculatedoverrideOtherCritters
- if true, overwrite heterospecifics upon inocuation. If false, try to find an empty microsite 500 times. If that doesn't work, go ahead and overwrite heterospecificspublic void neverInoculate()
public void noAA3()
public void scatter()
public void scatter2()
public void setAADispersalRadius(int AADispersalRadius)
AADispersalRadius
- public void setDispersalRadius(int dispersalRadius)
dispersalRadius
- public void setGrid(int[][] grid)
grid
- public void seTimeStep(int timeStep)
timeStep
- public void setKAAProduced(double KAAProduced)
KAAProduced
- public void setSeed(int setHere)
setHere
- public void setToStep1()
public void setToStep2()
public void step()
public void step(int numSteps)
numSteps
- public void step1()
public void step2()
public int[][] timeSeries(int numSteps, int measureHowOften, boolean reportDensity)
numSteps
- the time series is recorded over this many time stepsmeasureHowOften
- abundances are recorded once every this time stepspublic int[][] timeSeries(int start, int end, int measureHowOften, boolean reportDensity)
numSteps
- the time series is recorded over this many time stepsmeasureHowOften
- abundances are recorded once every this time steps