- All Known Subinterfaces:
TwosComplement.Signed
,TwosComplement.Unsigned
- All Known Implementing Classes:
Adapter.AsByte
,Adapter.AsByte.Signed
,Adapter.AsByte.Unsigned
,Adapter.AsInt
,Adapter.AsInt.Signed
,Adapter.AsInt.Unsigned
,Adapter.AsLong
,Adapter.AsLong.Signed
,Adapter.AsLong.Unsigned
,Adapter.AsShort
,Adapter.AsShort.Signed
,Adapter.AsShort.Unsigned
public interface TwosComplement
Methods that have variants on twos-complement Java types that might be signed
or unsigned.
The Signed
or Unsigned
subinterface below, as appropriate,
can be used as a mixin on a class where the right treatment of a Java
long
, int
, short
, or byte
might be
class-specific.
The semantic difference between a short
treated as unsigned and a
char
(also an unsigned 16-bit type) is whether the value is expected
to mean what UTF-16 says it means.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Mixin with default signed implementations of the interface methods.static interface
Mixin with default unsigned implementations of the interface methods. -
Method Summary
Modifier and TypeMethodDescriptionint
compare
(byte x, byte y) int
compare
(int x, int y) int
compare
(long x, long y) int
compare
(short x, short y) default String
deparse
(byte i) deparse
(byte i, int radix) default String
deparse
(int i) deparse
(int i, int radix) default String
deparse
(long i) deparse
(long i, int radix) default String
deparse
(short i) deparse
(short i, int radix) byte
divide
(byte dividend, byte divisor) int
divide
(int dividend, int divisor) long
divide
(long dividend, long divisor) short
divide
(short dividend, short divisor) default byte
default byte
parseByte
(CharSequence s, int radix) byte
parseByte
(CharSequence s, int beginIndex, int endIndex, int radix) default int
default int
parseInt
(CharSequence s, int radix) int
parseInt
(CharSequence s, int beginIndex, int endIndex, int radix) default long
default long
parseLong
(CharSequence s, int radix) long
parseLong
(CharSequence s, int beginIndex, int endIndex, int radix) default short
default short
parseShort
(CharSequence s, int radix) short
parseShort
(CharSequence s, int beginIndex, int endIndex, int radix) byte
remainder
(byte dividend, byte divisor) int
remainder
(int dividend, int divisor) long
remainder
(long dividend, long divisor) short
remainder
(short dividend, short divisor) int
toInt
(byte i) int
toInt
(short i) long
toLong
(byte i) long
toLong
(int i) long
toLong
(short i) short
toShort
(byte i) boolean
unsigned()
-
Method Details
-
unsigned
boolean unsigned() -
compare
int compare(long x, long y) -
divide
long divide(long dividend, long divisor) -
remainder
long remainder(long dividend, long divisor) -
parseLong
-
deparse
-
parseLong
-
parseLong
-
deparse
-
compare
int compare(int x, int y) -
divide
int divide(int dividend, int divisor) -
remainder
int remainder(int dividend, int divisor) -
toLong
long toLong(int i) -
parseInt
-
deparse
-
parseInt
-
parseInt
-
deparse
-
compare
int compare(short x, short y) -
divide
short divide(short dividend, short divisor) -
remainder
short remainder(short dividend, short divisor) -
toLong
long toLong(short i) -
toInt
int toInt(short i) -
parseShort
-
deparse
-
parseShort
-
parseShort
-
deparse
-
compare
int compare(byte x, byte y) -
divide
byte divide(byte dividend, byte divisor) -
remainder
byte remainder(byte dividend, byte divisor) -
toLong
long toLong(byte i) -
toInt
int toInt(byte i) -
toShort
short toShort(byte i) -
parseByte
-
deparse
-
parseByte
-
parseByte
-
deparse
-