artefaktur
software engineer &        architecture

 
 
 
 

class Number

Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   Namespace Members   Compound Members   Related Pages  

acdk::lang::Number Class Reference

#include <Number.h>

Inheritance diagram for acdk::lang::Number:

acdk::lang::Object acdk::io::Serializable acdk::lang::ObjectBase acdk::lang::dmi::StdDispatch acdk::lang::Byte acdk::lang::Double acdk::lang::Float acdk::lang::Integer acdk::lang::Long acdk::lang::Short List of all members.

Detailed Description

This class provides some extended number parsing routines which also supports the extended unicode code character set and localization.

API: Java + ACDK

Author:
Roger Rene Kommer
Version:
Revision
1.20
Date:
Date
2005/04/09 19:26:48


Public Member Functions

 Number ()
virtual byte byteValue ()=0
virtual short shortValue ()=0
virtual int intValue ()=0
virtual jlong longValue ()=0
virtual float floatValue ()=0
virtual double doubleValue ()=0
virtual int hashCode ()
virtual dmi::ScriptVar toScriptVar ()
template<class T> template_static T toBigEndian (T t)
 group to convert plattform pendig bit order to or from BigEndian which will be used in Serialization and network

template<class T> template_static T fromBigEndian (T t)
template<class T> template_static T fromLittleEndian (T t)
template<class T> template_static T toLittleEndian (T t)
template<class T> template_static T swapBits (T t)
template<class T> template_static int getBitCountOf (T)
template<class T> template_static int bitCount (T val)
template<class T> template_static T rotateLeft (T val, int count)
template<class T> template_static T rotateRight (T val, int count)

Static Public Member Functions

jlong decodeIntegerNumber (IN(RString) str, INOUT(bool) tryOnly, INOUT(char) typeChar, INOUT(int) ignoreaTrailing, bool ignoreLeadingWs=false) throw ( RNumberFormatException )
jlong parseIntegerNumber (IN(RString) str, int radix, INOUT(bool) tryOnly, INOUT(char) typeChar, INOUT(int) ignoreTrailing, bool ignoreLeadingSpaces=false) throw ( RNumberFormatException )
double parseFloatNumber (IN(RString) str, INOUT(bool) tryOnly, INOUT(char) typeChar, INOUT(int) ignoreTrailing, bool ignoreLeadingSpaces=false, IN(acdk::util::RLocale) locale=Nil) throw ( RNumberFormatException )
 working method

char getSmallestTypeChar (jlong number)
 return one of the typeChar which fits this number

char getSmallestTypeChar (double number)
 return one of the float type char, in which this number fits

RNumber getNumber (jlong value, char typeChar=0) throw ( RNumberFormatException )
 creates a number instance of given value.

RNumber getNumber (double value, char typeChar=0) throw ( RNumberFormatException )
 creates a number instance of given value.

RNumber decodeToNumber (IN(RString) str, bool tryOnly=false, bool ignoreLeadingWs=false, IN(acdk::util::RLocale) locale=Nil) throw ( RNumberFormatException )
 Parses a number from a unicode string if the string is a decimal string (radix = 10) all unicode character are allowed, which are digits (not limited to 0 - 9).

RNumber parseToIntegerNumber (IN(RString) str, int radix, bool tryOnly=false, bool ignoreLeadingSpaces=false) throw ( RNumberFormatException )
 parses a string to given integer number

void getFractionAndExponentSignFromLocale (IN(acdk::util::RLocale) locale, OUT(ucchar) fraction, OUT(ucchar) exponent)
void swap2 (char *ptr)
void swap4 (char *ptr)
void swap8 (char *ptr)

Constructor & Destructor Documentation

acdk::lang::Number::Number  )  [inline]
 


Member Function Documentation

template<class T>
template_static int acdk::lang::Number::bitCount val  )  [inline]
 

virtual byte acdk::lang::Number::byteValue  )  [pure virtual]
 

Implemented in acdk::lang::Byte, acdk::lang::Double, acdk::lang::Float, acdk::lang::Integer, acdk::lang::Long, and acdk::lang::Short.

jlong acdk::lang::Number::decodeIntegerNumber IN(RString str,
INOUT(bool)  tryOnly,
INOUT(char)  typeChar,
INOUT(int)  ignoreaTrailing,
bool  ignoreLeadingWs = false
throw ( RNumberFormatException ) [static]
 

RNumber acdk::lang::Number::decodeToNumber IN(RString str,
bool  tryOnly = false,
bool  ignoreLeadingWs = false,
IN(acdk::util::RLocale locale = Nil
throw ( RNumberFormatException ) [static]
 

Parses a number from a unicode string if the string is a decimal string (radix = 10) all unicode character are allowed, which are digits (not limited to 0 - 9).

Parameters:
str the string to parse
tryOnly if tryOnly is true this method does'nt throw a RNumberFormatException, but only returns Nil if the string cannot be decoded to a number
ignoreLeadingWs ignore leading white spaces
locale if locale is Nil it uses the C / en_US locale otherwise the given locale to parse the float number

virtual double acdk::lang::Number::doubleValue  )  [pure virtual]
 

Implemented in acdk::lang::Byte, acdk::lang::Double, acdk::lang::Float, acdk::lang::Integer, acdk::lang::Long, and acdk::lang::Short.

virtual float acdk::lang::Number::floatValue  )  [pure virtual]
 

Implemented in acdk::lang::Byte, acdk::lang::Double, acdk::lang::Float, acdk::lang::Integer, acdk::lang::Long, and acdk::lang::Short.

template<class T>
template_static T acdk::lang::Number::fromBigEndian t  )  [inline]
 

template<class T>
template_static T acdk::lang::Number::fromLittleEndian t  )  [inline]
 

template<class T>
template_static int acdk::lang::Number::getBitCountOf  )  [inline]
 

void acdk::lang::Number::getFractionAndExponentSignFromLocale IN(acdk::util::RLocale locale,
OUT(ucchar fraction,
OUT(ucchar exponent
[static]
 

Parameters:
locale may be Nil
fraction if locale is Nil it returns '.'
exponent if locle is Nil it returns 'e'

RNumber acdk::lang::Number::getNumber double  value,
char  typeChar = 0
throw ( RNumberFormatException ) [static]
 

creates a number instance of given value.

If typeChar is not given (= 0) it returns a class, which the value fits in

RNumber acdk::lang::Number::getNumber jlong  value,
char  typeChar = 0
throw ( RNumberFormatException ) [static]
 

creates a number instance of given value.

If typeChar is not given (= 0) it returns a class, which the value fits in

char acdk::lang::Number::getSmallestTypeChar double  number  )  [static]
 

return one of the float type char, in which this number fits

char acdk::lang::Number::getSmallestTypeChar jlong  number  )  [static]
 

return one of the typeChar which fits this number

virtual int acdk::lang::Number::hashCode  )  [inline, virtual]
 

See also:
serialized_hashCode

Reimplemented from acdk::lang::Object.

Reimplemented in acdk::lang::Double, acdk::lang::Float, acdk::lang::Integer, acdk::lang::Long, and acdk::lang::Short.

virtual int acdk::lang::Number::intValue  )  [pure virtual]
 

Implemented in acdk::lang::Byte, acdk::lang::Double, acdk::lang::Float, acdk::lang::Integer, acdk::lang::Long, and acdk::lang::Short.

virtual jlong acdk::lang::Number::longValue  )  [pure virtual]
 

Implemented in acdk::lang::Byte, acdk::lang::Double, acdk::lang::Float, acdk::lang::Integer, acdk::lang::Long, and acdk::lang::Short.

double acdk::lang::Number::parseFloatNumber IN(RString str,
INOUT(bool)  tryOnly,
INOUT(char)  typeChar,
INOUT(int)  ignoreTrailing,
bool  ignoreLeadingSpaces = false,
IN(acdk::util::RLocale locale = Nil
throw ( RNumberFormatException ) [static]
 

working method

Parameters:
str the string to parse
tryOnly if parsing and the float cannot be parsed it does not throw an exception otherwise this param will be set to false if parsing failed
typeChar hint which type was parsed
ignoreLeadingSpaces ignore leading spaces
ignoreTrailing if this is 0 it the method only succeed if the complete string was parsed otherwise it return the index position into the string where parsing was stopped
locale if locale is Nil it uses the C / en_US locale otherwise the given locale to parse the float number see also decodeIntegerNumber

jlong acdk::lang::Number::parseIntegerNumber IN(RString str,
int  radix,
INOUT(bool)  tryOnly,
INOUT(char)  typeChar,
INOUT(int)  ignoreTrailing,
bool  ignoreLeadingSpaces = false
throw ( RNumberFormatException ) [static]
 

Parameters:
tryOnly if true, method doesn't throws RNumberFormatException In this case method set tryOnly = false and return error information in return value: 0 -> general number format error -1 -> over/underflow
typeChar 'b' or 'B' -> byte 's' or 'S' -> short 'i' or 'I' -> integer 'l' or 'L' -> long 'f' or 'F' -> float 'd' or 'D' -> double if typeChar == 0 no asumption of type is given. If the postfix value is set in String, it will be set by this method

RNumber acdk::lang::Number::parseToIntegerNumber IN(RString str,
int  radix,
bool  tryOnly = false,
bool  ignoreLeadingSpaces = false
throw ( RNumberFormatException ) [static]
 

parses a string to given integer number

template<class T>
template_static T acdk::lang::Number::rotateLeft val,
int  count
[inline]
 

template<class T>
template_static T acdk::lang::Number::rotateRight val,
int  count
[inline]
 

virtual short acdk::lang::Number::shortValue  )  [pure virtual]
 

Implemented in acdk::lang::Byte, acdk::lang::Double, acdk::lang::Float, acdk::lang::Integer, acdk::lang::Long, and acdk::lang::Short.

void acdk::lang::Number::swap2 char *  ptr  )  [inline, static]
 

void acdk::lang::Number::swap4 char *  ptr  )  [inline, static]
 

void acdk::lang::Number::swap8 char *  ptr  )  [inline, static]
 

template<class T>
template_static T acdk::lang::Number::swapBits t  )  [inline]
 

template<class T>
template_static T acdk::lang::Number::toBigEndian t  )  [inline]
 

group to convert plattform pendig bit order to or from BigEndian which will be used in Serialization and network

template<class T>
template_static T acdk::lang::Number::toLittleEndian t  )  [inline]
 

virtual dmi::ScriptVar acdk::lang::Number::toScriptVar  )  [virtual]
 

Reimplemented in acdk::lang::Byte, acdk::lang::Double, acdk::lang::Float, acdk::lang::Integer, acdk::lang::Long, and acdk::lang::Short.

 
Last modified 2005-05-08 18:32 by SYSTEM By Artefaktur, Ing. Bureau Kommer