#include <src/main/decaf/lang/Short.h>
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.
|
Constructor & Destructor Documentation
decaf::lang::Short::Short |
( |
short |
value | ) |
|
decaf::lang::Short::Short |
( |
const std::string & |
value | ) |
|
- Parameters
-
value | The string value to convert to short and wrap. |
- Exceptions
-
NumberFormatException | if the string is not well formed number value. |
virtual decaf::lang::Short::~Short |
( |
| ) |
|
|
inlinevirtual |
Member Function Documentation
virtual unsigned char decaf::lang::Short::byteValue |
( |
| ) |
const |
|
inlinevirtual |
Answers the byte value which the receiver represents.
- Returns
- int the value of the receiver.
Reimplemented from decaf::lang::Number.
virtual int decaf::lang::Short::compareTo |
( |
const Short & |
s | ) |
const |
|
virtual |
Compares this Short instance with another.
- Parameters
-
s | - the Short instance to be compared |
- Returns
- zero if this object represents the same short value as the argument; a positive value if this object represents a value greater than the passed in value, and -1 if this object represents a value less than the passed in value.
Implements decaf::lang::Comparable< Short >.
virtual int decaf::lang::Short::compareTo |
( |
const short & |
s | ) |
const |
|
virtual |
Compares this Short instance with another.
- Parameters
-
s | - the Short instance to be compared |
- Returns
- zero if this object represents the same short value as the argument; a positive value if this object represents a value greater than the passed in value, and -1 if this object represents a value less than the passed in value.
Implements decaf::lang::Comparable< short >.
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. |
virtual double decaf::lang::Short::doubleValue |
( |
| ) |
const |
|
inlinevirtual |
Answers the double value which the receiver represents.
- Returns
- double the value of the receiver.
Implements decaf::lang::Number.
bool decaf::lang::Short::equals |
( |
const Short & |
s | ) |
const |
|
inlinevirtual |
bool decaf::lang::Short::equals |
( |
const short & |
s | ) |
const |
|
inlinevirtual |
virtual float decaf::lang::Short::floatValue |
( |
| ) |
const |
|
inlinevirtual |
Answers the float value which the receiver represents.
- Returns
- float the value of the receiver.
Implements decaf::lang::Number.
virtual int decaf::lang::Short::intValue |
( |
| ) |
const |
|
inlinevirtual |
Answers the int value which the receiver represents.
- Returns
- int the value of the receiver.
Implements decaf::lang::Number.
virtual long long decaf::lang::Short::longValue |
( |
| ) |
const |
|
inlinevirtual |
Answers the long value which the receiver represents.
- Returns
- long the value of the receiver.
Implements decaf::lang::Number.
virtual bool decaf::lang::Short::operator< |
( |
const Short & |
s | ) |
const |
|
inlinevirtual |
Compares this object to another and returns true if this object is considered to be less than the one passed.
This
- Parameters
-
s | - the value to be compared to this one. |
- Returns
- true if this object is equal to the one passed.
Implements decaf::lang::Comparable< Short >.
virtual bool decaf::lang::Short::operator< |
( |
const short & |
s | ) |
const |
|
inlinevirtual |
Compares this object to another and returns true if this object is considered to be less than the one passed.
This
- Parameters
-
s | - the value to be compared to this one. |
- Returns
- true if this object is equal to the one passed.
Implements decaf::lang::Comparable< short >.
virtual bool decaf::lang::Short::operator== |
( |
const Short & |
s | ) |
const |
|
inlinevirtual |
Compares equality between this object and the one passed.
- Parameters
-
s | - the value to be compared to this one. |
- Returns
- true if this object is equal to the one passed.
Implements decaf::lang::Comparable< Short >.
virtual bool decaf::lang::Short::operator== |
( |
const short & |
s | ) |
const |
|
inlinevirtual |
Compares equality between this object and the one passed.
- Parameters
-
s | - the value to be compared to this one. |
- Returns
- true if this object is equal to the one passed.
Implements decaf::lang::Comparable< short >.
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. |
static short decaf::lang::Short::reverseBytes |
( |
short |
value | ) |
|
|
static |
Returns the value obtained by reversing the order of the bytes in the two's complement representation of the specified short value.
- Parameters
-
value | - the short whose bytes we are to reverse |
- Returns
- the reversed short.
virtual short decaf::lang::Short::shortValue |
( |
| ) |
const |
|
inlinevirtual |
Answers the short value which the receiver represents.
- Returns
- int the value of the receiver.
Reimplemented from decaf::lang::Number.
std::string decaf::lang::Short::toString |
( |
| ) |
const |
static std::string decaf::lang::Short::toString |
( |
short |
value | ) |
|
|
static |
- Returns
- a string representing the primitive value as Base 10
static Short decaf::lang::Short::valueOf |
( |
short |
value | ) |
|
|
static |
Returns a Short instance representing the specified short value.
- Parameters
-
- Returns
- the new Short object wrapping value.
static Short decaf::lang::Short::valueOf |
( |
const std::string & |
value | ) |
|
|
static |
Returns a Short object holding the value given by the specified std::string.
The argument is interpreted as representing a signed decimal short, exactly as if the argument were given to the parseShort( std::string ) method. The result is a Short object that represents the short value specified by the string.
- Parameters
-
value | - std::string to parse as base 10 |
- Returns
- new Short Object wrapping the primitive
- Exceptions
-
NumberFormatException | if the string is not a decimal short. |
static Short decaf::lang::Short::valueOf |
( |
const std::string & |
value, |
|
|
int |
radix |
|
) |
| |
|
static |
Returns a Short object holding the value extracted from the specified std::string when parsed with the radix given by the second argument.
The first argument is interpreted as representing a signed short in the radix specified by the second argument, exactly as if the argument were given to the parseShort( std::string, int ) method. The result is a Short object that represents the short value specified by the string.
- Parameters
-
value | - std::string to parse as base ( radix ) |
radix | - base of the string to parse. |
- Returns
- new Short Object wrapping the primitive
- Exceptions
-
NumberFormatException | if the string is not a valid short. |
Field Documentation
const short decaf::lang::Short::MAX_VALUE = (short)0x7FFF |
|
static |
Max Value for this Object's primitive type.
const short decaf::lang::Short::MIN_VALUE = (short)0x8000 |
|
static |
Max Value for this Object's primitive type.
const int decaf::lang::Short::SIZE = 16 |
|
static |
Size of this objects primitive type in bits.
The documentation for this class was generated from the following file: