public class SuccessorUtil extends Object
BytesUtil#successor(byte[]), which computes the successor of a variable
length unsigned byte[].
Modifier and Type | Field and Description |
---|---|
static double |
DNEG_MAX
Largest negative double.
|
static double |
DNEG_MIN
Smallest non-zero negative value.
|
static double |
DNEG_ONE
Negative one (-1d).
|
static double |
DNEG_ZERO
Negative zero (-0d).
|
static double |
DPOS_MAX
Largest positive double.
|
static double |
DPOS_MIN
Smallest non-zero positive value.
|
static double |
DPOS_ONE
Positive one (1d).
|
static double |
DPOS_ZERO
Positive zero (+0d).
|
static float |
FNEG_MAX
Largest negative float.
|
static float |
FNEG_MIN
Smallest non-zero negative value.
|
static float |
FNEG_ONE
Negative one (-1f).
|
static float |
FNEG_ZERO
Negative zero (-0f).
|
static float |
FPOS_MAX
Largest positive float.
|
static float |
FPOS_MIN
Smallest non-zero positive value.
|
static float |
FPOS_ONE
Positive one (1f).
|
static float |
FPOS_ZERO
Positive zero (+0f).
|
Constructor and Description |
---|
SuccessorUtil() |
Modifier and Type | Method and Description |
---|---|
static byte |
successor(byte n)
Computes the successor of a
byte value. |
static byte[] |
successor(byte[] b)
Modifies a byte[] as a side-effect so that it represents its successor
when interpreted as a fixed length bit string.
|
static byte[] |
successor(byte[] b,
int off,
int len)
Modifies a byte[] as a side-effect so that it represents its successor
when interpreted as a fixed length bit string.
|
static char |
successor(char n)
Computes the successor of a
char value. |
static double |
successor(double d)
Computes the successor of a
double value. |
static float |
successor(float f)
Computes the successor of a
float value. |
static int |
successor(int n)
Computes the successor of an
int value. |
static long |
successor(long n)
Computes the successor of a
long value. |
static short |
successor(short n)
Computes the successor of a
short value. |
static String |
successor(String s)
The successor of a string value is formed by appending a
nul . |
public static final float FPOS_ZERO
Note: +0f and -0f will compare as _equal_ in the language. This means that you can not write tests that directly distinguish positive and negative zero using >, <, or ==.
public static final float FNEG_ZERO
Note: +0f and -0f will compare as _equal_ in the language. This means that you can not write tests that directly distinguish positive and negative zero using >, <, or ==.
public static final float FPOS_MIN
public static final float FNEG_MIN
public static final float FPOS_ONE
public static final float FNEG_ONE
public static final float FPOS_MAX
public static final float FNEG_MAX
public static final double DPOS_ZERO
Note: +0d and -0d will compare as _equal_ in the language. This means that you can not write tests that directly distinguish positive and negative zero using >, <, or ==.
public static final double DNEG_ZERO
Note: +0d and -0d will compare as _equal_ in the language. This means that you can not write tests that directly distinguish positive and negative zero using >, <, or ==.
public static final double DPOS_MIN
public static final double DNEG_MIN
public static final double DPOS_ONE
public static final double DNEG_ONE
public static final double DPOS_MAX
public static final double DNEG_MAX
public static byte successor(byte n) throws NoSuccessorException
byte
value.n
- A valueNoSuccessorException
- if there is no successor for that value.public static char successor(char n) throws NoSuccessorException
char
value.n
- A valueNoSuccessorException
- if there is no successor for that value.public static short successor(short n) throws NoSuccessorException
short
value.n
- A valueNoSuccessorException
- if there is no successor for that value.public static int successor(int n) throws NoSuccessorException
int
value.n
- A valueNoSuccessorException
- if there is no successor for that value.public static long successor(long n) throws NoSuccessorException
long
value.n
- A valueNoSuccessorException
- if there is no successor for that value.public static float successor(float f) throws NoSuccessorException
Computes the successor of a float
value.
The IEEE floating point standard provides a means for computing the next
larger or smaller floating point value using a bit manipulation trick.
See
Comparing floating point numbers by Bruce Dawson. The Java
Float
and Double
classes provide the static methods
required to convert a float or double into its IEEE 754 floating point
bit layout, which can be treated as an int (for floats) or a long (for
doubles). By testing for the sign, you can just add (or subtract) one (1)
to get the bit pattern of the successor (see the above referenced
article). Special exceptions must be made for NaNs, negative infinity and
positive infinity.
f
- The float value.float
.NoSuccessorException
- if there is no next value in the value space.public static double successor(double d) throws NoSuccessorException
Computes the successor of a double
value.
The IEEE floating point standard provides a means for computing the next
larger or smaller floating point value using a bit manipulation trick.
See
Comparing floating point numbers by Bruce Dawson. The Java
Float
and Double
classes provide the static methods
required to convert a float or double into its IEEE 754 floating point
bit layout, which can be treated as an int (for floats) or a long (for
doubles). By testing for the sign, you can just add (or subtract) one (1)
to get the bit pattern of the successor (see the above referenced
article). Special exceptions must be made for NaNs, negative infinity and
positive infinity.
d
- The double value.double
.NoSuccessorException
- if there is no next value in the value space.public static String successor(String s)
nul
.
The successor of a null
string reference is an empty
string. The successor of a string value is defined unless the string is
too long.s
- The string reference or null
.null
public static byte[] successor(byte[] b)
b
- NoSuccessorException
- If all bytes overflow.NoSuccessorException
- If the byte[] has zero length.public static byte[] successor(byte[] b, int off, int len)
b
- The byte[].off
- The offset of the start of the bitstring in the byte[].len
- The #of bytes in the bit string within the byte[].NoSuccessorException
- If all bytes overflow.NoSuccessorException
- If the byte[] has zero length.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.