Debian Codegraph @

src/dr/inferencexml/operators/NegationOperatorParser.java

raw symbols SCIP
1 package dr.inferencexml.operators;
2
3 import dr.inference.model.Parameter;
4 import dr.inference.operators.NegationOperator;
5 import dr.xml.*;
6
7 /**
8 * Created by maxryandolinskytolkoff on 8/17/16.
9 */
10 public class NegationOperatorParser extends AbstractXMLObjectParser {
11 public final static String NEGATION_OPERATOR = "negationOperator";
12 public final static String WEIGHT = "weight";
13
14 @Override
15 public Object parseXMLObject(XMLObject xo) throws XMLParseException {
16 Parameter data = (Parameter) xo.getChild(Parameter.class);
17 double weight = xo.getDoubleAttribute(WEIGHT);
18
19 return new NegationOperator(data, weight);
20 }
21
22 @Override
23 public XMLSyntaxRule[] getSyntaxRules() {
24 return new XMLSyntaxRule[0];
25 }
26
27 private final XMLSyntaxRule[] rules = {
28 new ElementRule(Parameter.class),
29 AttributeRule.newDoubleRule(WEIGHT),
30 };
31
32 @Override
33 public String getParserDescription() {
34 return null;
35 }
36
37 @Override
38 public Class getReturnType() {
39 return NegationOperatorParser.class;
40 }
41
42 @Override
43 public String getParserName() {
44 return NEGATION_OPERATOR;
45 }
46 }