Debian Codegraph @

src/dr/evolution/coalescent/ScaledDemographic.java

raw symbols SCIP
1 /*
2 * ScaledDemographic.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.evolution.coalescent;
27
28 /**
29 * Scale a demographic by a fixed factor.
30 *
31 * Minimal implementation, only value and intensity implemented.
32 *
33 * @author Joseph Heled
34 * Date: 19/11/2007
35 */
36 public class ScaledDemographic extends DemographicFunction.Abstract {
37 private final double scale;
38 private final DemographicFunction demo;
39
40 public ScaledDemographic(DemographicFunction demo, double scale) {
41 super(demo.getUnits());
42 this.scale = scale;
43 this.demo = demo;
44 }
45
46 public double getDemographic(double t) {
47 return demo.getDemographic(t) * scale;
48 }
49
50 public double getIntensity(double t) {
51 return demo.getIntensity(t) / scale;
52 }
53
54 public double getIntegral(double start, double finish) {
55 return (demo.getIntensity(finish) - demo.getIntensity(start)) / scale;
56 }
57
58 public double getInverseIntensity(double x) {
59 throw new RuntimeException("unimplemented");
60 }
61
62 public int getNumArguments() {
63 throw new RuntimeException("unimplemented");
64 }
65
66 public String getArgumentName(int n) {
67 throw new RuntimeException("unimplemented");
68 }
69
70 public double getArgument(int n) {
71 throw new RuntimeException("unimplemented");
72 }
73
74 public void setArgument(int n, double value) {
75 throw new RuntimeException("unimplemented");
76 }
77
78 public double getLowerBound(int n) {
79 throw new RuntimeException("unimplemented");
80 }
81
82 public double getUpperBound(int n) {
83 throw new RuntimeException("unimplemented");
84 }
85
86 public DemographicFunction getCopy() {
87 throw new RuntimeException("unimplemented");
88 }
89 }