| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 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 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 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 |
|
| 66 |
|
| 67 |
} |
| 68 |
|
| 69 |
public final double getDeathRate(int length) { |
| 70 |
return deathRateParameter.getParameterValue(0); |
| 71 |
} |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
public String getModelComponentName() { |
| 78 |
return TKF91ModelParser.TKF91_MODEL; |
| 79 |
} |
| 80 |
|
| 81 |
protected void handleModelChangedEvent(Model model, Object object, int index) { |
| 82 |
|
| 83 |
listenerHelper.fireModelChanged(this, object, index); |
| 84 |
} |
| 85 |
|
| 86 |
protected final void handleVariableChangedEvent(Variable variable, int index, Parameter.ChangeType type) { |
| 87 |
|
| 88 |
} |
| 89 |
|
| 90 |
protected void storeState() { |
| 91 |
} |
| 92 |
|
| 93 |
protected void acceptState() { |
| 94 |
} |
| 95 |
|
| 96 |
protected void restoreState() { |
| 97 |
} |
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
public Element createElement(Document doc) { |
| 104 |
throw new RuntimeException("Not implemented!"); |
| 105 |
} |
| 106 |
|
| 107 |
} |