Debian Codegraph @

src/dr/evomodel/alloppnet/parsers/MulTreeNodeSlideParser.java

raw symbols SCIP
1
2 /*
3 * MulTreeNodeSlideParser.java
4 *
5 * Copyright (c) 2002-2017 Alexei Drummond, Andrew Rambaut and Marc Suchard
6 *
7 * This file is part of BEAST.
8 * See the NOTICE file distributed with this work for additional
9 * information regarding copyright ownership and licensing.
10 *
11 * BEAST is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as
13 * published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * BEAST is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with BEAST; if not, write to the
23 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
24 * Boston, MA 02110-1301 USA
25 */
26
27 package dr.evomodel.alloppnet.parsers;
28
29 import dr.evomodel.alloppnet.operators.MulTreeNodeSlide;
30 import dr.evomodel.alloppnet.speciation.MulSpeciesBindings;
31 import dr.evomodel.alloppnet.speciation.MulSpeciesTreeModel;
32 import dr.inference.operators.MCMCOperator;
33 import dr.xml.*;
34
35 /**
36 *
37 * @author Graham Jones
38 * Date: 20/12/2011
39 */
40 public class MulTreeNodeSlideParser extends AbstractXMLObjectParser {
41 public static final String MULTREE_NODE_REHEIGHT = "mulTreeNodeReHeight";
42
43 public String getParserName() {
44 return MULTREE_NODE_REHEIGHT;
45 }
46
47 public Object parseXMLObject(XMLObject xo) throws XMLParseException {
48 MulSpeciesBindings species = (MulSpeciesBindings) xo.getChild(MulSpeciesBindings.class);
49 MulSpeciesTreeModel tree = (MulSpeciesTreeModel) xo.getChild(MulSpeciesTreeModel.class);
50
51 final double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
52 // final double range = xo.getAttribute("range", 1.0);
53 // if( range <= 0 || range > 1.0 ) {
54 // throw new XMLParseException("range out of range");
55 // }
56 //final boolean oo = xo.getAttribute("outgroup", false);
57 return new MulTreeNodeSlide(tree, species /*, range*//*, oo*/, weight);
58 }
59
60 public String getParserDescription() {
61 return "Specialized Species tree operator, transform tree without breaking embedding of gene trees.";
62 }
63
64 public Class getReturnType() {
65 return MulTreeNodeSlide.class;
66 }
67
68 public XMLSyntaxRule[] getSyntaxRules() {
69 return new XMLSyntaxRule[]{
70 AttributeRule.newDoubleRule(MCMCOperator.WEIGHT),
71 // AttributeRule.newDoubleRule("range", true),
72 // AttributeRule.newBooleanRule("outgroup", true),
73
74 new ElementRule(MulSpeciesBindings.class),
75 new ElementRule(MulSpeciesTreeModel.class)
76 };
77 }
78
79 }