Debian Codegraph @

src/dr/evolution/coalescent/ConstantPopulation.java

raw symbols SCIP
1 /*
2 * ConstantPopulation.java
3 *
4 * Copyright (c) 2002-2015 Alexei Drummond, Andrew Rambaut and Marc Suchard
5 *
6 * This file is part of BEAST.
7 * See the NOTICE file distributed with this work for additional
8 * information regarding copyright ownership and licensing.
9 *
10 * BEAST is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as
12 * published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 *
15 * BEAST is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with BEAST; if not, write to the
22 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
23 * Boston, MA 02110-1301 USA
24 */
25
26 package dr.evolution.coalescent;
27
28 /**
29 * This class models coalescent intervals for a constant population
30 * (parameter: N0=present-day population size). <BR>
31 * If time units are set to Units.EXPECTED_SUBSTITUTIONS then
32 * the N0 parameter will be interpreted as N0 * mu. <BR>
33 * Also note that if you are dealing with a diploid population
34 * N0 will be out by a factor of 2.
35 *
36 * @author Andrew Rambaut
37 * @author Alexei Drummond
38 *
39 * @version $Id: ConstantPopulation.java,v 1.9 2005/05/24 20:25:55 rambaut Exp $
40 *
41 */
42 public class ConstantPopulation extends DemographicFunction.Abstract
43 {
44 //
45 // Public stuff
46 //
47
48 /**
49 * Construct demographic model with default settings
50 * @param units
51 */
52 public ConstantPopulation(Type units) {
53
54 super(units);
55 }
56
57 /**
58 * @return initial population size.
59 */
60 public double getN0() { return N0; }
61
62 /**
63 * sets initial population size.
64 * @param N0 new size
65 */
66 public void setN0(double N0) { this.N0 = N0; }
67
68
69 // Implementation of abstract methods
70
71 public double getDemographic(double t) { return getN0(); }
72 public double getIntensity(double t) { return t/getN0(); }
73 public double getInverseIntensity(double x) { return getN0()*x; }
74
75 // same as abstract
76 // /**
77 // * Calculates the integral 1/N(x) dx between start and finish. The
78 // * inherited function in DemographicFunction.Abstract calls a
79 // * numerical integrater which is unecessary.
80 // */
81 // public double getIntegral(double start, double finish) {
82 // return getIntensity(finish) - getIntensity(start);
83 // }
84 //
85 public int getNumArguments() {
86 return 1;
87 }
88
89 public String getArgumentName(int n) {
90 return "N0";
91 }
92
93 public double getArgument(int n) {
94 return getN0();
95 }
96
97 public void setArgument(int n, double value) {
98 setN0(value);
99 }
100
101 public double getLowerBound(int n) {
102 return 0.0;
103 }
104
105 public double getUpperBound(int n) {
106 return Double.POSITIVE_INFINITY;
107 }
108
109 public DemographicFunction getCopy() {
110 ConstantPopulation df = new ConstantPopulation(getUnits());
111 df.N0 = N0;
112
113 return df;
114 }
115
116 //
117 // private stuff
118 //
119
120 private double N0;
121 }