Public Member Functions |
| Short (short value) |
| Short (const std::string &value) |
virtual | ~Short () |
virtual int | compareTo (const Short &s) const |
| Compares this Short instance with another.
|
bool | equals (const Short &s) const |
virtual bool | operator== (const Short &s) const |
| Compares equality between this object and the one passed.
|
virtual bool | operator< (const Short &s) const |
| Compares this object to another and returns true if this object is considered to be less than the one passed.
|
virtual int | compareTo (const short &s) const |
| Compares this Short instance with another.
|
bool | equals (const short &s) const |
virtual bool | operator== (const short &s) const |
| Compares equality between this object and the one passed.
|
virtual bool | operator< (const short &s) const |
| Compares this object to another and returns true if this object is considered to be less than the one passed.
|
std::string | toString () const |
virtual double | doubleValue () const |
| Answers the double value which the receiver represents.
|
virtual float | floatValue () const |
| Answers the float value which the receiver represents.
|
virtual unsigned char | byteValue () const |
| Answers the byte value which the receiver represents.
|
virtual short | shortValue () const |
| Answers the short value which the receiver represents.
|
virtual int | intValue () const |
| Answers the int value which the receiver represents.
|
virtual long long | longValue () const |
| Answers the long value which the receiver represents.
|
Static Public Member Functions |
static std::string | toString (short value) |
static Short | decode (const std::string &value) |
| Decodes a String into a Short.
|
static short | reverseBytes (short value) |
| Returns the value obtained by reversing the order of the bytes in the two's complement representation of the specified short value.
|
static short | parseShort (const std::string &s, int radix) |
| Parses the string argument as a signed short in the radix specified by the second argument.
|
static short | parseShort (const std::string &s) |
| Parses the string argument as a signed decimal short.
|
static Short | valueOf (short value) |
| Returns a Short instance representing the specified short value.
|
static Short | valueOf (const std::string &value) |
| Returns a Short object holding the value given by the specified std::string.
|
static Short | valueOf (const std::string &value, int radix) |
| Returns a Short object holding the value extracted from the specified std::string when parsed with the radix given by the second argument.
|
Static Public Attributes |
static const int | SIZE = 16 |
| Size of this objects primitive type in bits.
|
static const short | MAX_VALUE = (short)0x7FFF |
| Max Value for this Object's primitive type.
|
static const short | MIN_VALUE = (short)0x8000 |
| Max Value for this Object's primitive type.
|
static Short decaf::lang::Short::decode |
( |
const std::string & |
value | ) |
[static] |
Decodes a String into a Short.
Accepts decimal, hexadecimal, and octal numbers given by the following grammar:
The sequence of characters following an (optional) negative sign and/or radix specifier ("0x", "0X", "#", or leading zero) is parsed as by the Short.parseShort method with the indicated radix (10, 16, or 8). This sequence of characters must represent a positive value or a NumberFormatException will be thrown. The result is negated if first character of the specified String is the minus sign. No whitespace characters are permitted in the string.
- Parameters:
-
value | - The string to decode |
- Returns:
- a Short object containing the decoded value
- Exceptions:
-
NumberFomatException | if the string is not formatted correctly. |
static short decaf::lang::Short::parseShort |
( |
const std::string & |
s, |
|
|
int |
radix |
|
) |
| [static] |
Parses the string argument as a signed short in the radix specified by the second argument.
The characters in the string must all be digits, of the specified radix (as determined by whether Character.digit(char, int) returns a nonnegative value) except that the first character may be an ASCII minus sign '-' to indicate a negative value. The resulting byte value is returned.
An exception of type NumberFormatException is thrown if any of the following situations occurs: * The first argument is null or is a string of length zero. * The radix is either smaller than Character.MIN_RADIX or larger than Character.MAX_RADIX. * Any character of the string is not a digit of the specified radix, except that the first character may be a minus sign '-' provided that the string is longer than length 1. * The value represented by the string is not a value of type short.
- Parameters:
-
s | - the String containing the short representation to be parsed |
radix | - the radix to be used while parsing s |
- Returns:
- the short represented by the string argument in the specified radix.
- Exceptions:
-
NumberFormatException | - If String does not contain a parsable short. |
static short decaf::lang::Short::parseShort |
( |
const std::string & |
s | ) |
[static] |
Parses the string argument as a signed decimal short.
The characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign '-' to indicate a negative value. The resulting short value is returned, exactly as if the argument and the radix 10 were given as arguments to the parseShort( const std::string, int ) method.
- Parameters:
-
s | - String to convert to a short |
- Returns:
- the converted short value
- Exceptions:
-
NumberFormatException | if the string is not a short. |