~ubuntu-branches/ubuntu/quantal/libpal-java/quantal

« back to all changes in this revision

Viewing changes to src/pal/misc/MutableDouble.java

  • Committer: Package Import Robot
  • Author(s): Andreas Tille
  • Date: 2012-01-27 13:57:54 UTC
  • Revision ID: package-import@ubuntu.com-20120127135754-d63l3581f65fw9pk
Tags: upstream-1.5.1
ImportĀ upstreamĀ versionĀ 1.5.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// MutableDouble.java
 
2
//
 
3
// (c) 1999-2004 PAL Development Core Team
 
4
//
 
5
// This package may be distributed under the
 
6
// terms of the Lesser GNU General Public License (LGPL)
 
7
 
 
8
 
 
9
package pal.misc;
 
10
 
 
11
import java.io.*;
 
12
import java.util.Enumeration;
 
13
 
 
14
 
 
15
 
 
16
/**
 
17
 * interface for holding a double, that may be mutated and referenced by more than one user
 
18
 *
 
19
 * @version $Id: MutableDouble.java,v 1.2 2004/10/19 02:23:19 matt Exp $
 
20
 *
 
21
 * @author Matthew Goode
 
22
 */
 
23
 
 
24
import java.util.*;
 
25
 
 
26
public class MutableDouble implements java.io.Serializable{
 
27
        private final double defaultValue_;
 
28
        private final double minimumValue_;
 
29
        private final double maximumValue_;
 
30
        private double se_;
 
31
        private double currentValue_;
 
32
 
 
33
        private final String name_;
 
34
 
 
35
        /** The default value is also the initial value.
 
36
        */
 
37
        public MutableDouble(double initialValue, double defaultValue, double minimumValue, double maximumValue, String name) {
 
38
                this.currentValue_ = defaultValue;
 
39
                this.defaultValue_ = defaultValue;
 
40
                this.minimumValue_ = minimumValue;
 
41
                this.maximumValue_ = maximumValue;
 
42
                this.name_ = name;
 
43
        }
 
44
 
 
45
        /** Set the current value of this double */
 
46
        public final void setValue(double value) { this.currentValue_ = value;  }
 
47
 
 
48
        /** Get the current value of this double */
 
49
        public final double getValue() {        return currentValue_;   }
 
50
 
 
51
        public final double getLowerLimit() {   return minimumValue_;   }
 
52
 
 
53
        public final double getUpperLimit() {   return maximumValue_;   }
 
54
 
 
55
        public final double getDefaultValue() { return defaultValue_;   }
 
56
 
 
57
        public final double getSE() {   return se_;     }
 
58
        public final void setSE(double value) { se_ = value;    }
 
59
        public final String getName() { return name_; }
 
60
        public String toString() {
 
61
                return name_+":"+currentValue_;
 
62
        }
 
63
}