| 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.evomodelxml.operators; |
| 27 |
|
| 28 |
import dr.evomodel.operators.PatternWeightIncrementOperator; |
| 29 |
import dr.evomodel.treelikelihood.BeagleTreeLikelihood; |
| 30 |
import dr.xml.*; |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
public class PatternWeightIncrementOperatorParser extends AbstractXMLObjectParser { |
| 36 |
|
| 37 |
public String getParserName() { |
| 38 |
return PatternWeightIncrementOperator.PATTERN_WEIGHT_INCREMENT_OPERATOR; |
| 39 |
} |
| 40 |
|
| 41 |
public Object parseXMLObject(XMLObject xo) throws XMLParseException { |
| 42 |
|
| 43 |
BeagleTreeLikelihood treeLikelihood = (BeagleTreeLikelihood) xo.getChild(BeagleTreeLikelihood.class); |
| 44 |
final double weight = xo.getDoubleAttribute("weight"); |
| 45 |
return new PatternWeightIncrementOperator(treeLikelihood, weight); |
| 46 |
} |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
public String getParserDescription() { |
| 53 |
return "This element progressively adds sites into the pattern list."; |
| 54 |
} |
| 55 |
|
| 56 |
public Class getReturnType() { |
| 57 |
return PatternWeightIncrementOperator.class; |
| 58 |
} |
| 59 |
|
| 60 |
public XMLSyntaxRule[] getSyntaxRules() { |
| 61 |
return rules; |
| 62 |
} |
| 63 |
|
| 64 |
private final XMLSyntaxRule[] rules = { |
| 65 |
AttributeRule.newDoubleRule("weight"), |
| 66 |
new ElementRule(BeagleTreeLikelihood.class), |
| 67 |
}; |
| 68 |
} |