|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.jackrabbit.core.query.lucene.DecimalField
public class DecimalField
The DecimalField class is a utility to convert
java.math.BigDecimal values to String
values that are lexicographically sortable according to the decimal value.
The string format uses the characters '0' to '9' and consists of:
{ value signum +2 }
{ exponent signum +2 }
{ exponent length -1 }
{ exponent value }
{ value (-1 if inverted) }
Only the signum is encoded if the value is zero. The exponent is not
encoded if zero. Negative values are "inverted" character by character
('0' -> 9, '1' -> '8', and so on). The same applies to the exponent.
Examples: 0 => "2" 2 => "322" (signum 1; exponent 0; value 2) 120 => "330212" (signum 1; exponent signum 1, length 1, value 2; value 12). -1 => "179" (signum -1, rest inverted; exponent 0; value 1 (-1, inverted).
Values between BigDecimal(BigInteger.ONE, Integer.MIN_VALUE) and BigDecimal(BigInteger.ONE, Integer.MAX_VALUE) are supported.
| Constructor Summary | |
|---|---|
DecimalField()
|
|
| Method Summary | |
|---|---|
static String |
decimalToString(BigDecimal value)
Convert a BigDecimal to a String. |
static BigDecimal |
stringToDecimal(String value)
Convert a String to a BigDecimal. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DecimalField()
| Method Detail |
|---|
public static String decimalToString(BigDecimal value)
value - the BigDecimal
public static BigDecimal stringToDecimal(String value)
value - the String
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||