Debian Codegraph @

src/dr/oldevomodel/indel/TKF91Model.java

raw symbols SCIP
1 /*
2 * TKF91Model.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.oldevomodel.indel;
27
28 import dr.oldevomodelxml.indel.TKF91ModelParser;
29 import dr.inference.model.Model;
30 import dr.inference.model.Parameter;
31 import dr.inference.model.Variable;
32 import org.w3c.dom.Document;
33 import org.w3c.dom.Element;
34
35 /**
36 * This class models a constant mutation rate
37 * (parameter: mu = mutation rate). <BR>
38 *
39 * @author Alexei Drummond
40 * @version $Id: TKF91Model.java,v 1.7 2005/05/24 20:25:57 rambaut Exp $
41 */
42 public class TKF91Model extends IndelModel {
43
44 private final Parameter lengthDistParameter, deathRateParameter;
45
46 public TKF91Model(Parameter lengthDistParameter, Parameter deathRateParameter, Type units) {
47 super(TKF91ModelParser.TKF91_MODEL);
48
49 this.lengthDistParameter = lengthDistParameter;
50 addVariable(lengthDistParameter);
51
52 this.deathRateParameter = deathRateParameter;
53 addVariable(deathRateParameter);
54
55 setUnits(units);
56 }
57
58 public final double getLengthDistributionValue() {
59 return lengthDistParameter.getParameterValue(0);
60 }
61
62 public final double getBirthRate(int length) {
63
64 throw new RuntimeException("Not implemented");
65 //return birthRateParameter.getParameterValue(0);
66
67 }
68
69 public final double getDeathRate(int length) {
70 return deathRateParameter.getParameterValue(0);
71 }
72
73 // *****************************************************************
74 // Interface ModelComponent
75 // *****************************************************************
76
77 public String getModelComponentName() {
78 return TKF91ModelParser.TKF91_MODEL;
79 }
80
81 protected void handleModelChangedEvent(Model model, Object object, int index) {
82 // Substitution model has changed so fire model changed event
83 listenerHelper.fireModelChanged(this, object, index);
84 }
85
86 protected final void handleVariableChangedEvent(Variable variable, int index, Parameter.ChangeType type) {
87 // no intermediates need to be recalculated...
88 }
89
90 protected void storeState() {
91 } // no extra state apart from parameters
92
93 protected void acceptState() {
94 } // no extra state apart from parameters
95
96 protected void restoreState() {
97 } // no extra state apart from parameters
98
99 // **************************************************************
100 // XMLElement IMPLEMENTATION
101 // **************************************************************
102
103 public Element createElement(Document doc) {
104 throw new RuntimeException("Not implemented!");
105 }
106
107 }