Debian Codegraph @

src/dr/evomodel/coalescent/DemographicModel.java

raw symbols SCIP
1 /*
2 * DemographicModel.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.evomodel.coalescent;
27
28 import dr.evolution.coalescent.DemographicFunction;
29 import dr.evolution.util.Units;
30 import dr.inference.model.AbstractModel;
31 import dr.inference.model.Model;
32 import dr.inference.model.Parameter;
33 import dr.inference.model.Variable;
34
35 /**
36 * This interface provides methods that describe a demographic model.
37 * <p/>
38 * Parts of this class were derived from C++ code provided by Oliver Pybus.
39 *
40 * @author Andrew Rambaut
41 * @author Alexei Drummond
42 * @author Korbinian Strimmer
43 * @version $Id: DemographicModel.java,v 1.28 2005/09/26 14:27:38 rambaut Exp $
44 */
45 public abstract class DemographicModel extends AbstractModel implements Units {
46
47 public DemographicModel(String name) {
48 super(name);
49 }
50
51 // general functions
52
53 public abstract DemographicFunction getDemographicFunction();
54
55 // **************************************************************
56 // Model IMPLEMENTATION
57 // **************************************************************
58
59 protected void handleModelChangedEvent(Model model, Object object, int index) {
60 // no intermediates need to be recalculated...
61 }
62
63 protected void handleVariableChangedEvent(Variable variable, int index, Parameter.ChangeType type) {
64 // no intermediates need to be recalculated...
65 }
66
67 protected void storeState() {
68 } // no additional state needs storing
69
70 protected void restoreState() {
71 } // no additional state needs restoring
72
73 protected void acceptState() {
74 } // no additional state needs accepting
75
76 // **************************************************************
77 // Units IMPLEMENTATION
78 // **************************************************************
79
80 /**
81 * Units in which population size is measured.
82 */
83 private Type units;
84
85 /**
86 * sets units of measurement.
87 *
88 * @param u units
89 */
90 public void setUnits(Type u) {
91 units = u;
92 }
93
94 /**
95 * returns units of measurement.
96 */
97 public Type getUnits() {
98 return units;
99 }
100 }