1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.onemind.commons.java.lang;
22
23 /***
24 * An mutable long
25 * @author TiongHiang Lee (thlee@onemindsoft.org)
26 * @version $Id: MutableLong.java,v 1.3 2004/09/03 13:24:14 thlee Exp $ $Name: $
27 */
28 public class MutableLong extends Number
29 {
30
31 /*** the long value * */
32 private long _value;
33
34 /***
35 * {@inheritDoc}
36 * @param l the long value
37 */
38 public MutableLong(long l)
39 {
40 _value = l;
41 }
42
43 /***
44 * Set the long value
45 * @param l the long value
46 */
47 public final void set(long l)
48 {
49 _value = l;
50 }
51
52 /***
53 * {@inheritDoc}
54 */
55 public final byte byteValue()
56 {
57 return (byte) _value;
58 }
59
60 /***
61 * {@inheritDoc}
62 */
63 public final double doubleValue()
64 {
65 return (double) _value;
66 }
67
68 /***
69 * {@inheritDoc}
70 */
71 public final float floatValue()
72 {
73 return (float) _value;
74 }
75
76 /***
77 * {@inheritDoc}
78 */
79 public final int intValue()
80 {
81 return (int) _value;
82 }
83
84 /***
85 * {@inheritDoc}
86 */
87 public final long longValue()
88 {
89 return _value;
90 }
91
92 /***
93 * {@inheritDoc}
94 */
95 public final short shortValue()
96 {
97 return (short) _value;
98 }
99
100 /***
101 * increase by i
102 * @param i the value to increase
103 */
104 public void inc(long i)
105 {
106 _value += i;
107 }
108
109 /***
110 * decrease by i
111 * @param i the value to decrease
112 */
113 public void dec(long i)
114 {
115 _value -= i;
116 }
117
118 /***
119 * {@inheritDoc}
120 */
121 public String toString()
122 {
123 return String.valueOf(_value);
124 }
125 }