Package org.apache.wicket.util.value
Class LongValue
- java.lang.Object
-
- org.apache.wicket.util.value.LongValue
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<LongValue>
public class LongValue extends java.lang.Object implements java.lang.Comparable<LongValue>, java.io.Serializable
A base class based on the Javalongprimitive for value classes that want to implement standard operations on that value without the pain of aggregating aLongobject.- Since:
- 1.2.6
- Author:
- Jonathan Locke
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected longvaluethelongvalue
-
Constructor Summary
Constructors Constructor Description LongValue(long value)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(LongValue that)Compares thisObjectto a givenObject.booleanequals(java.lang.Object that)Tests for equality.booleangreaterThan(long value)Compares thisLongValuewith a primitivelongvalue.booleangreaterThan(LongValue that)Compares thisLongValuewith anotherLongValue.booleangreaterThanOrEqual(long value)Compares thisLongValuewith a primitivelongvalue.booleangreaterThanOrEqual(LongValue that)Compares thisLongValuewith anotherLongValue.inthashCode()Returns the hash code for thisObject.booleanlessThan(long that)Compares thisLongValuewith a primitivelongvalue.booleanlessThan(LongValue that)Compares thisLongValuewith anotherLongValue.booleanlessThanOrEqual(long that)Compares thisLongValuewith a primitivelongvalue.booleanlessThanOrEqual(LongValue that)Compares thisLongValuewith anotherLongValue.static <T extends LongValue>
Tmax(T lhs, T rhs)Returns the max of the two long values.static <T extends LongValue>
TmaxNullSafe(T lhs, T rhs)Null-safe version ofmax(T, T).static <T extends LongValue>
Tmin(T lhs, T rhs)Returns the min of the two long values.java.lang.StringtoString()Converts thisLongValueto aString.
-
-
-
Method Detail
-
compareTo
public final int compareTo(LongValue that)
Compares thisObjectto a givenObject.- Specified by:
compareToin interfacejava.lang.Comparable<LongValue>- Parameters:
that- theObjectto compare with- Returns:
- 0 if equal, -1 if less than the given
Object's value, or 1 if greater than givenObject's value
-
equals
public final boolean equals(java.lang.Object that)
Tests for equality.- Overrides:
equalsin classjava.lang.Object- Parameters:
that- theObjectto compare with- Returns:
trueif thisObject's value is equal to the givenObject's value
-
greaterThan
public final boolean greaterThan(long value)
Compares thisLongValuewith a primitivelongvalue.- Parameters:
value- thelongvalue to compare with- Returns:
trueif thisLongValueis greater than the givenlongvalue
-
greaterThanOrEqual
public final boolean greaterThanOrEqual(long value)
Compares thisLongValuewith a primitivelongvalue.- Parameters:
value- thelongvalue to compare with- Returns:
trueif thisLongValueis greater than or equal to the givenlongvalue
-
greaterThan
public final boolean greaterThan(LongValue that)
Compares thisLongValuewith anotherLongValue.- Parameters:
that- theLongValueto compare with- Returns:
trueif thisLongValueis greater than the givenLongValue
-
greaterThanOrEqual
public final boolean greaterThanOrEqual(LongValue that)
Compares thisLongValuewith anotherLongValue.- Parameters:
that- theLongValueto compare with- Returns:
trueif thisLongValueis greater than or equal to the givenLongValue
-
hashCode
public final int hashCode()
Returns the hash code for thisObject.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hash code for this
Object
-
lessThan
public final boolean lessThan(long that)
Compares thisLongValuewith a primitivelongvalue.- Parameters:
that- thelongvalue to compare with- Returns:
trueif thisLongValueis less than the givenlongvalue
-
lessThanOrEqual
public final boolean lessThanOrEqual(long that)
Compares thisLongValuewith a primitivelongvalue.- Parameters:
that- thelongvalue to compare with- Returns:
trueif thisLongValueis less than or equal to the givenlongvalue
-
lessThan
public final boolean lessThan(LongValue that)
Compares thisLongValuewith anotherLongValue.- Parameters:
that- theLongValuevalue to compare with- Returns:
trueif thisLongValueis less than the givenLongValue
-
lessThanOrEqual
public final boolean lessThanOrEqual(LongValue that)
Compares thisLongValuewith anotherLongValue.- Parameters:
that- theLongValuevalue to compare with- Returns:
trueif thisLongValueis less than or equal to the givenLongValue
-
toString
public java.lang.String toString()
Converts thisLongValueto aString.- Overrides:
toStringin classjava.lang.Object- Returns:
- a
Stringrepresentation of thisLongValue
-
min
public static <T extends LongValue> T min(T lhs, T rhs)
Returns the min of the two long values.- Type Parameters:
T-- Parameters:
lhs-rhs-- Returns:
- min value
- Throws:
java.lang.IllegalArgumentException- if either argument isnull
-
max
public static <T extends LongValue> T max(T lhs, T rhs)
Returns the max of the two long values.- Type Parameters:
T-- Parameters:
lhs-rhs-- Returns:
- max value
- Throws:
java.lang.IllegalArgumentException- if either argument isnull
-
-