Source code: safejdbc/holder/FloatHolder.java
1 // Copyright (c) 2001, Jan Hermanns & Arno Haase
2 // All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or
5 // without modification, are permitted provided that the
6 // following conditions are met:
7 //
8 // * Redistributions of source code must retain the above
9 // copyright notice, this list of conditions and the
10 // following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the
13 // following disclaimer in the documentation and/or other
14 // materials provided with the distribution.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
17 // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
18 // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 // DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
21 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
24 // OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30 package safejdbc.holder;
31
32
33 /** This class is designed to hold a float. It is useful to pass a float into and out
34 * of a code block such as a ResultSetProcessor or a FillingCommand. For an overview
35 * see the <a href="package-summary.html">package overview</a>.
36 */
37 public class FloatHolder {
38
39 private float _value;
40
41 public FloatHolder(float value) {
42 setValue(value);
43 }
44
45 public float getValue() {
46 return _value;
47 }
48
49 public void setValue(float value) {
50 _value = value;
51 }
52
53 public void add (float value) {
54 _value += value;
55 }
56
57 public void subtrace (float value) {
58 _value -= value;
59 }
60
61 public void multiply (float value) {
62 _value *= value;
63 }
64
65 public void divide (float value) {
66 _value /= value;
67 }
68 }