Debian Codegraph @

src/dr/inference/model/ComplementParameter.java

raw symbols SCIP
1 /*
2 * ComplementParameter.java
3 *
4 * Copyright (c) 2002-2016 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.inference.model;
27
28 /**
29 * @author Marc Suchard
30 */
31 public class ComplementParameter extends Parameter.Abstract implements VariableListener {
32
33 public ComplementParameter(Parameter parameter) {
34 this.parameter = parameter;
35
36 parameter.addVariableListener(this);
37 }
38
39 public int getDimension() {
40 return parameter.getDimension();
41 }
42
43 protected void storeValues() {
44 parameter.storeParameterValues();
45 }
46
47 protected void restoreValues() {
48 parameter.restoreParameterValues();
49 }
50
51 protected void acceptValues() {
52 parameter.acceptParameterValues();
53 }
54
55 protected void adoptValues(Parameter source) {
56 throw new RuntimeException("Not implemented");
57 }
58
59 public double getParameterValue(int dim) {
60 return 1.0 - parameter.getParameterValue(dim);
61 }
62
63 public void setParameterValue(int dim, double value) {
64 throw new RuntimeException("Not implemented");
65 }
66
67 public void setParameterValueQuietly(int dim, double value) {
68 throw new RuntimeException("Not implemented");
69 }
70
71 public void setParameterValueNotifyChangedAll(int dim, double value) {
72 throw new RuntimeException("Not implemented");
73 }
74
75 public String getParameterName() {
76 if (getId() == null) {
77 StringBuilder sb = new StringBuilder("complement");
78
79 sb.append(".").append(parameter.getId());
80
81 setId(sb.toString());
82 }
83 return getId();
84 }
85
86 public void addBounds(Bounds bounds) {
87 this.bounds = bounds;
88 }
89
90 public Bounds<Double> getBounds() {
91 if (bounds == null) {
92 return parameter.getBounds(); // TODO
93 } else {
94 return bounds;
95 }
96 }
97
98 public void addDimension(int index, double value) {
99 throw new RuntimeException("Not yet implemented.");
100 }
101
102 public double removeDimension(int index) {
103 throw new RuntimeException("Not yet implemented.");
104 }
105
106 public void variableChangedEvent(Variable variable, int index, ChangeType type) {
107 fireParameterChangedEvent(index, type);
108 }
109
110 private final Parameter parameter;
111 private Bounds bounds = null;
112 }