diff --git a/Foundation/CPCountedSet.j b/Foundation/CPCountedSet.j index ccad1365f..a99b94a98 100644 --- a/Foundation/CPCountedSet.j +++ b/Foundation/CPCountedSet.j @@ -40,12 +40,12 @@ [super addObject:anObject]; - var hash = [anObject hash]; + var UID = [anObject UID]; - if (_counts[hash] === undefined) - _counts[hash] = 1; + if (_counts[UID] === undefined) + _counts[UID] = 1; else - ++_counts[hash]; + ++_counts[UID]; } - (void)removeObject:(id)anObject @@ -53,18 +53,18 @@ if (!_counts) return; - var hash = [anObject hash]; + var UID = [anObject UID]; - if (_counts[hash] === undefined) + if (_counts[UID] === undefined) return; else { - --_counts[hash]; + --_counts[UID]; - if (_counts[hash] === 0) + if (_counts[UID] === 0) { - delete _counts[hash]; + delete _counts[UID]; [super removeObject:anObject]; } } @@ -85,12 +85,12 @@ if (!_counts) _counts = {}; - var hash = [anObject hash]; + var UID = [anObject UID]; - if (_counts[hash] === undefined) + if (_counts[UID] === undefined) return 0; - return _counts[hash]; + return _counts[UID]; } diff --git a/Foundation/CPJSONPConnection.j b/Foundation/CPJSONPConnection.j index 7076697f3..f721291f7 100644 --- a/Foundation/CPJSONPConnection.j +++ b/Foundation/CPJSONPConnection.j @@ -86,7 +86,7 @@ CPJSONPCallbackReplacementString = @"${JSONP_CALLBACK}"; { try { - CPJSONPConnectionCallbacks["callback"+[self hash]] = function(data) + CPJSONPConnectionCallbacks["callback"+[self UID]] = function(data) { [_delegate connection:self didReceiveData:data]; [self removeScriptTag]; @@ -100,11 +100,11 @@ CPJSONPCallbackReplacementString = @"${JSONP_CALLBACK}"; if (_callbackParameter) { source += (source.indexOf('?') < 0) ? "?" : "&"; - source += _callbackParameter+"=CPJSONPConnectionCallbacks.callback"+[self hash]; + source += _callbackParameter+"=CPJSONPConnectionCallbacks.callback"+[self UID]; } else if (source.indexOf(CPJSONPCallbackReplacementString) >= 0) { - source = [source stringByReplacingOccurrencesOfString:CPJSONPCallbackReplacementString withString:"CPJSONPConnectionCallbacks.callback"+[self hash]]; + source = [source stringByReplacingOccurrencesOfString:CPJSONPCallbackReplacementString withString:"CPJSONPConnectionCallbacks.callback"+[self UID]]; } else return; @@ -130,8 +130,8 @@ CPJSONPCallbackReplacementString = @"${JSONP_CALLBACK}"; if(_scriptTag && _scriptTag.parentNode == head) head.removeChild(_scriptTag); - CPJSONPConnectionCallbacks["callback"+[self hash]] = nil; - delete CPJSONPConnectionCallbacks["callback"+[self hash]]; + CPJSONPConnectionCallbacks["callback"+[self UID]] = nil; + delete CPJSONPConnectionCallbacks["callback"+[self UID]]; } - (void)cancel diff --git a/Foundation/CPKeyValueCoding.j b/Foundation/CPKeyValueCoding.j index cc661e80e..59720316a 100644 --- a/Foundation/CPKeyValueCoding.j +++ b/Foundation/CPKeyValueCoding.j @@ -45,9 +45,9 @@ CPUnknownUserInfoKey = @"CPUnknownUserInfoKey"; if (!CPObjectAccessorsForClass) CPObjectAccessorsForClass = [CPDictionary dictionary]; - var hash = [isa hash], + var UID = [isa UID], selector = nil, - accessors = [CPObjectAccessorsForClass objectForKey:hash]; + accessors = [CPObjectAccessorsForClass objectForKey:UID]; if (accessors) { @@ -60,7 +60,7 @@ CPUnknownUserInfoKey = @"CPUnknownUserInfoKey"; { accessors = [CPDictionary dictionary]; - [CPObjectAccessorsForClass setObject:accessors forKey:hash]; + [CPObjectAccessorsForClass setObject:accessors forKey:UID]; } var capitalizedKey = aKey.charAt(0).toUpperCase() + aKey.substr(1); @@ -88,9 +88,9 @@ CPUnknownUserInfoKey = @"CPUnknownUserInfoKey"; if (!CPObjectModifiersForClass) CPObjectModifiersForClass = [CPDictionary dictionary]; - var hash = [isa hash], + var UID = [isa UID], selector = nil, - modifiers = [CPObjectModifiersForClass objectForKey:hash]; + modifiers = [CPObjectModifiersForClass objectForKey:UID]; if (modifiers) { @@ -103,7 +103,7 @@ CPUnknownUserInfoKey = @"CPUnknownUserInfoKey"; { modifiers = [CPDictionary dictionary]; - [CPObjectModifiersForClass setObject:modifiers forKey:hash]; + [CPObjectModifiersForClass setObject:modifiers forKey:UID]; } if (selector) diff --git a/Foundation/CPKeyValueObserving.j b/Foundation/CPKeyValueObserving.j index 107b80810..189bf803a 100644 --- a/Foundation/CPKeyValueObserving.j +++ b/Foundation/CPKeyValueObserving.j @@ -58,7 +58,7 @@ if (!anObserver || !aPath) return; - [[KVOProxyMap objectForKey:[self hash]] _removeObserver:anObserver forKeyPath:aPath]; + [[KVOProxyMap objectForKey:[self UID]] _removeObserver:anObserver forKeyPath:aPath]; } + (BOOL)automaticallyNotifiesObserversForKey:(CPString)aKey @@ -119,7 +119,7 @@ var KVOProxyMap = [CPDictionary dictionary], + (id)proxyForObject:(CPObject)anObject { - var proxy = [KVOProxyMap objectForKey:[anObject hash]]; + var proxy = [KVOProxyMap objectForKey:[anObject UID]]; if (proxy) return proxy; @@ -128,7 +128,7 @@ var KVOProxyMap = [CPDictionary dictionary], [proxy _replaceClass]; - [KVOProxyMap setObject:proxy forKey:[anObject hash]]; + [KVOProxyMap setObject:proxy forKey:[anObject UID]]; return proxy; } @@ -215,12 +215,12 @@ var KVOProxyMap = [CPDictionary dictionary], if (!composedOfKeys) return; - var dependentKeysForClass = [DependentKeysMap objectForKey:[_nativeClass hash]]; + var dependentKeysForClass = [DependentKeysMap objectForKey:[_nativeClass UID]]; if (!dependentKeysForClass) { dependentKeysForClass = [CPDictionary new]; - [DependentKeysMap setObject:dependentKeysForClass forKey:[_nativeClass hash]]; + [DependentKeysMap setObject:dependentKeysForClass forKey:[_nativeClass UID]]; } for (var i=0, count=composedOfKeys.length; i */ - (CPString)description { - return "<" + isa.name + " 0x" + [CPString stringWithHash:[self hash]] + ">"; + return "<" + isa.name + " 0x" + [CPString stringWithHash:[self UID]] + ">"; } // Sending Messages @@ -357,7 +357,7 @@ CPLog(@"Got some class: %@", inst); { [CPException raise:CPInvalidArgumentException reason: (class_isMetaClass(isa) ? "+" : "-") + " [" + [self className] + " " + aSelector + "] unrecognized selector sent to " + - (class_isMetaClass(isa) ? "class" : "instance") + " 0x" + [CPString stringWithHash:[self hash]]]; + (class_isMetaClass(isa) ? "class" : "instance") + " 0x" + [CPString stringWithHash:[self UID]]]; } // Archiving @@ -482,7 +482,7 @@ CPLog(@"Got some class: %@", inst); */ - (BOOL)isEqual:(id)anObject { - return self === anObject || [self hash] === [anObject hash]; + return self === anObject || [self UID] === [anObject UID]; } /*! diff --git a/Foundation/CPSet.j b/Foundation/CPSet.j index 824b925dc..02cbeaef5 100644 --- a/Foundation/CPSet.j +++ b/Foundation/CPSet.j @@ -232,7 +232,7 @@ */ - (BOOL)containsObject:(id)anObject { - if (_contents[[anObject hash]] && [_contents[[anObject hash]] isEqual:anObject]) + if (_contents[[anObject UID]] && [_contents[[anObject UID]] isEqual:anObject]) return YES; return NO; @@ -372,7 +372,7 @@ */ - (void)addObject:(id)anObject { - _contents[[anObject hash]] = anObject; + _contents[[anObject UID]] = anObject; _count++; } @@ -396,7 +396,7 @@ { if ([self containsObject:anObject]) { - delete _contents[[anObject hash]]; + delete _contents[[anObject UID]]; _count--; } }