24 #define CAST_TO_INT(x) ((x) >= 0 ? Math.floor((x)) : Math.ceil((x))) 46 var result =
new Number();
47 result.isa = [
self class];
51 + (id)numberWithBool:(BOOL)aBoolean
53 return aBoolean ? 1 : 0;
56 + (id)numberWithChar:(
char)aChar
59 return aChar.charCodeAt(0);
64 + (id)numberWithDouble:(
double)aDouble
69 + (id)numberWithFloat:(
float)aFloat
74 + (id)numberWithInt:(
int)anInt
79 + (id)numberWithLong:(
long)aLong
84 + (id)numberWithLongLong:(
long long)aLongLong
89 + (id)numberWithShort:(
short)aShort
94 + (id)numberWithUnsignedChar:(
unsigned char)aChar
97 return aChar.charCodeAt(0);
102 + (id)numberWithUnsignedInt:(
unsigned)anUnsignedInt
104 return anUnsignedInt;
107 + (id)numberWithUnsignedLong:(
unsigned long)anUnsignedLong
109 return anUnsignedLong;
117 + (id)numberWithUnsignedShort:(
unsigned short)anUnsignedShort
119 return anUnsignedShort;
122 - (id)initWithBool:(BOOL)aBoolean
127 - (id)initWithChar:(
char)aChar
129 if (aChar.charCodeAt)
130 return aChar.charCodeAt(0);
135 - (id)initWithDouble:(
double)aDouble
140 - (id)initWithFloat:(
float)aFloat
145 - (id)initWithInt:(
int)anInt
150 - (id)initWithLong:(
long)aLong
155 - (id)initWithLongLong:(
long long)aLongLong
160 - (id)initWithShort:(
short)aShort
165 - (id)initWithUnsignedChar:(
unsigned char)aChar
167 if (aChar.charCodeAt)
168 return aChar.charCodeAt(0);
173 - (id)initWithUnsignedInt:(
unsigned)anUnsignedInt
175 return anUnsignedInt;
178 - (id)initWithUnsignedLong:(
unsigned long)anUnsignedLong
180 return anUnsignedLong;
188 - (id)initWithUnsignedShort:(
unsigned short)anUnsignedShort
190 return anUnsignedShort;
199 UID = objj_generateObjectUID();
209 return self ? true :
false;
214 return String.fromCharCode(
self);
220 - (CPDecimal)decimalValue
222 throw new Error(
"decimalValue: NOT YET IMPLEMENTED");
228 return self.toString();
230 throw new Error(
"descriptionWithLocale: NOT YET IMPLEMENTED");
238 - (double)doubleValue
240 if (typeof
self ==
"boolean")
248 if (typeof
self ==
"boolean")
264 - (
long long)longLongValue
281 return self.toString();
284 - (
unsigned char)unsignedCharValue
286 return String.fromCharCode(
self);
289 - (
unsigned int)unsignedIntValue
301 - (
unsigned long)unsignedLongValue
307 - (
unsigned short)unsignedShortValue
315 if (aNumber === nil || aNumber[
'isa'] ===
CPNull)
320 else if (
self < aNumber)
328 return self == aNumber;
337 return [aCoder decodeObjectForKey:@"self"];
342 [aCoder encodeNumber:self forKey:@"self"];
Used to implement exception handling (creating & raising).
An object representation of nil.
void raise:reason:(CPString aName, [reason] CPString aReason)
A mutable key-value pair collection.
An immutable string (collection of characters).
Defines methods for use when archiving & restoring (enc/decoding).
A bridged object to native Javascript numbers.
CPString descriptionWithLocale:(CPDictionary aDictionary)
FrameUpdater prototype description