| FloatWrapper.java |
1 /**
2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3 *
4 * The contents of this file are subject to the terms of the Liferay Enterprise
5 * Subscription License ("License"). You may not use this file except in
6 * compliance with the License. You can obtain a copy of the License by
7 * contacting Liferay, Inc. See the License for the specific language governing
8 * permissions and limitations under the License, including but not limited to
9 * distribution rights of the Software.
10 *
11 *
12 *
13 */
14
15 package com.liferay.portal.kernel.util;
16
17 /**
18 * <a href="FloatWrapper.java.html"><b><i>View Source</i></b></a>
19 *
20 * @author Brian Wing Shun Chan
21 */
22 public class FloatWrapper
23 extends PrimitiveWrapper implements Comparable<FloatWrapper> {
24
25 public static final Class<?> TYPE = Float.TYPE;
26
27 public FloatWrapper() {
28 this(0F);
29 }
30
31 public FloatWrapper(float value) {
32 _value = value;
33 }
34
35 public int compareTo(FloatWrapper floatWrapper) {
36 if (floatWrapper == null) {
37 return 1;
38 }
39
40 if (getValue() > floatWrapper.getValue()) {
41 return 1;
42 }
43 else if (getValue() < floatWrapper.getValue()) {
44 return -1;
45 }
46 else {
47 return 0;
48 }
49 }
50
51 public float getValue() {
52 return _value;
53 }
54
55 public void setValue(float value) {
56 _value = value;
57 }
58
59 public float increment() {
60 return ++_value;
61 }
62
63 public float decrement() {
64 return --_value;
65 }
66
67 private float _value;
68
69 }