1 /***
2 * Copyright 2003, 2004, 2005. CodeStreet LLC.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
7 *
8 * Unless required by applicable law or agreed to in writing, software
9 * distributed under the License is distributed on an "AS IS" BASIS,
10 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 * See the License for the specific language governing permissions and
12 * limitations under the License.
13 */
14
15 package com.codestreet.selector.parser;
16
17 import java.math.BigDecimal;
18
19 /***
20 * Class to encapsulate numeric values.
21 * <p>
22 * This class allows easier conversion to <tt>C#</tt> using the JLCA tool from
23 * Microsoft since there is no <tt>Number</tt> class in <tt>C#</tt>.
24 *
25 * @author jawaid.hakim
26 */
27 public class NumericValue
28 {
29 /***
30 * Ctor.
31 *
32 * @param value
33 * Value.
34 */
35 public NumericValue(final Double value)
36 {
37 value_ = value;
38 }
39
40 /***
41 * Ctor.
42 *
43 * @param value
44 * Value.
45 */
46 public NumericValue(final Float value)
47 {
48 value_ = value;
49 }
50
51 /***
52 * Ctor.
53 *
54 * @param value
55 * Value.
56 */
57 public NumericValue(final Long value)
58 {
59 value_ = value;
60 }
61
62 /***
63 * Ctor.
64 *
65 * @param value
66 * Value.
67 */
68 public NumericValue(final Integer value)
69 {
70 value_ = value;
71 }
72
73 /***
74 * Ctor.
75 *
76 * @param value
77 * Value.
78 */
79 public NumericValue(final Byte value)
80 {
81 value_ = value;
82 }
83
84 /***
85 * Ctor.
86 *
87 * @param value
88 * Value.
89 */
90 public NumericValue(final Short value)
91 {
92 value_ = value;
93 }
94
95 /***
96 * Ctor.
97 *
98 * @param value
99 * Value.
100 */
101 public NumericValue(final BigDecimal value)
102 {
103 value_ = value;
104 }
105
106 /***
107 * Get <tt>double</tt> value.
108 *
109 * @return Double value.
110 */
111 public double doubleValue()
112 {
113 return ((Number) value_).doubleValue();
114 }
115
116 private Object value_;
117 }
This page was automatically generated by Maven