Debian Codegraph @

src/dr/evomodel/branchmodel/HomogeneousBranchModel.java

raw symbols SCIP
1 /*
2 * HomogeneousBranchModel.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.branchmodel;
27
28 import dr.evomodel.substmodel.FrequencyModel;
29 import dr.evomodel.substmodel.SubstitutionModel;
30 import dr.evolution.tree.NodeRef;
31 import dr.inference.model.AbstractModel;
32 import dr.inference.model.Model;
33 import dr.inference.model.Variable;
34
35 import java.util.ArrayList;
36 import java.util.Collections;
37 import java.util.List;
38
39 /**
40 * @author Andrew Rambaut
41 * @author Filip Bielejec
42 * @author Marc Suchard
43 * @version $Id$
44 */
45 public class HomogeneousBranchModel extends AbstractModel implements BranchModel {
46 private final SubstitutionModel substitutionModel;
47 private final FrequencyModel rootFrequencyModel;
48
49 public HomogeneousBranchModel(SubstitutionModel substitutionModel) {
50 this(substitutionModel, null);
51 }
52
53 public HomogeneousBranchModel(SubstitutionModel substitutionModel, FrequencyModel rootFrequencyModel) {
54 super("HomogeneousBranchModel");
55 this.substitutionModel = substitutionModel;
56 addModel(substitutionModel);
57 if (rootFrequencyModel != null) {
58 addModel(rootFrequencyModel);
59 this.rootFrequencyModel = rootFrequencyModel;
60 } else {
61 this.rootFrequencyModel = substitutionModel.getFrequencyModel();
62 }
63 }
64
65 public Mapping getBranchModelMapping(NodeRef node) {
66 return DEFAULT;
67 }
68
69 // @Override // use java 1.5
70 public List<SubstitutionModel> getSubstitutionModels() {
71 return Collections.singletonList(substitutionModel);
72 }
73
74 // @Override
75 public SubstitutionModel getRootSubstitutionModel() {
76 return substitutionModel;
77 }
78
79 public FrequencyModel getRootFrequencyModel() {
80 return rootFrequencyModel;
81 }
82
83 // @Override
84 public boolean requiresMatrixConvolution() {
85 return false;
86 }
87
88 @Override
89 protected void handleModelChangedEvent(Model model, Object object, int index) {
90 fireModelChanged();
91 }
92
93 @Override
94 protected void handleVariableChangedEvent(Variable variable, int index, Variable.ChangeType type) {
95 }
96
97 @Override
98 protected void storeState() {
99 }
100
101 @Override
102 protected void restoreState() {
103 }
104
105 @Override
106 protected void acceptState() {
107 }
108 }