Debian Codegraph @

src/dr/evomodel/branchratemodel/AbstractBranchRateModel.java

raw symbols SCIP
1 /*
2 * AbstractBranchRateModel.java
3 *
4 * Copyright (c) 2002-2015 Alexei Drummond, Andrew Rambaut and Marc Suchard
5 *
6 * This file is part of BEAST.
7 * See the NOTICE file distributed with this work for additional
8 * information regarding copyright ownership and licensing.
9 *
10 * BEAST is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as
12 * published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 *
15 * BEAST is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with BEAST; if not, write to the
22 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
23 * Boston, MA 02110-1301 USA
24 */
25
26 package dr.evomodel.branchratemodel;
27
28 import dr.evolution.tree.*;
29 import dr.inference.model.*;
30
31 /**
32 * An abstract base class for BranchRateModels to help implement some of the interfaces
33 * @author Andrew Rambaut
34 * @version $Id:$
35 */
36 public abstract class AbstractBranchRateModel extends AbstractModelLikelihood implements BranchRateModel {
37 /**
38 * @param name Model Name
39 */
40 public AbstractBranchRateModel(String name) {
41 super(name);
42 }
43
44 public String getTraitName() {
45 return BranchRateModel.RATE;
46 }
47
48 public Intent getIntent() {
49 return Intent.BRANCH;
50 }
51
52 public TreeTrait getTreeTrait(final String key) {
53 return this;
54 }
55
56 public TreeTrait[] getTreeTraits() {
57 return new TreeTrait[] { this };
58 }
59
60 public Class getTraitClass() {
61 return Double.class;
62 }
63
64 public boolean getLoggable() {
65 return true;
66 }
67
68 public Double getTrait(final Tree tree, final NodeRef node) {
69 return getBranchRate(tree, node);
70 }
71
72 public String getTraitString(final Tree tree, final NodeRef node) {
73 return Double.toString(getBranchRate(tree, node));
74 }
75
76 public Model getModel() {
77 return this;
78 }
79
80 public double getLogLikelihood() {
81 return 0;
82 }
83
84 public void makeDirty() {
85 // Do nothing
86 }
87 }