| 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.inferencexml.operators; |
| 27 |
|
| 28 |
import dr.inference.operators.SimpleMCMCOperator; |
| 29 |
import dr.xml.*; |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
public class ApplyOperatorOnceParser extends AbstractXMLObjectParser { |
| 36 |
|
| 37 |
public static final String APPLY = "applyOperatorOnce"; |
| 38 |
|
| 39 |
@Override |
| 40 |
public Object parseXMLObject(XMLObject xo) throws XMLParseException { |
| 41 |
|
| 42 |
for (int i = 0; i < xo.getChildCount(); ++i) { |
| 43 |
SimpleMCMCOperator operator = (SimpleMCMCOperator) xo.getChild(i); |
| 44 |
operator.doOperation(); |
| 45 |
} |
| 46 |
return null; |
| 47 |
} |
| 48 |
|
| 49 |
@Override |
| 50 |
public XMLSyntaxRule[] getSyntaxRules() { |
| 51 |
return new XMLSyntaxRule[]{ |
| 52 |
new ElementRule(SimpleMCMCOperator.class, 1, Integer.MAX_VALUE), |
| 53 |
}; |
| 54 |
} |
| 55 |
|
| 56 |
@Override |
| 57 |
public String getParserDescription() { |
| 58 |
return "Applies a series of operators once before continuing"; |
| 59 |
} |
| 60 |
|
| 61 |
@Override |
| 62 |
public Class getReturnType() { |
| 63 |
return ApplyOperatorOnceParser.class; |
| 64 |
} |
| 65 |
|
| 66 |
public String getParserName() { |
| 67 |
return APPLY; |
| 68 |
} |
| 69 |
} |