static TypeDesc intern(TypeDesc type) { return cInstances.put(type); }
public synchronized boolean contains(Object obj) { if (obj == null) { return false; } Entry<T>[] tab = this.table; int hash = hashCode(obj); int index = (hash & 0x7fffffff) % tab.length; for (Entry<T> e = tab[index], prev = null; e != null; e = e.next) { Object iobj = e.get(); if (iobj == null) { // Clean up after a cleared Reference. if (prev != null) { prev.next = e.next; } else { tab[index] = e.next; } this.count--; } else if (e.hash == hash && obj.getClass() == iobj.getClass() && equals(obj, iobj)) { // Found canonical instance. return true; } else { prev = e; } } return false; }
int hash = hashCode(obj); int index = (hash & 0x7fffffff) % entries.length; for (Entry<T> e = entries[index], prev = null; e != null; e = e.mNext) { } else if (e.mHash == hash && obj.getClass() == iobj.getClass() && equals(obj, iobj)) { cleanup(); if (mSize >= mThreshold) { rehash(); entries = mEntries; index = (hash & 0x7fffffff) % entries.length;
@Override public void remove() { mSet.removeCleared(this); } }
public IdentifierStore() { mIdentifiers = new WeakCanonicalSet<I>(); mObjectsToIdentifiers = Cache.newWeakIdentityCache(17); mIdentifiersToObjects = Cache.newWeakValueCache(17); }
public synchronized boolean contains(Object obj) { if (obj == null) { return false; } Entry<T>[] entries = mEntries; int hash = hashCode(obj); int index = (hash & 0x7fffffff) % entries.length; for (Entry<T> e = entries[index]; e != null; e = e.mNext) { Object iobj = e.get(); if (iobj != null && e.mHash == hash && obj.getClass() == iobj.getClass() && equals(obj, iobj)) { // Found canonical instance. return true; } } return false; }
static MethodDesc intern(MethodDesc desc) { return cInstances.put(desc); }
private Object readResolve() { return cCanonical.put(this); } }
private Object readResolve() { return cCanonical.put(this); } }
Object readResolve() { return cCanonical.put(this); }
synchronized I canonicalIdentifier(I id) { return mIdentifiers.put(id); }
Object readResolve() { return cCanonical.put(this); }
static TypeDesc intern(TypeDesc type) { return cInstances.put(type); }
static MethodDesc intern(MethodDesc desc) { return cInstances.put(desc); }
static <T> RParameter<T> intern(RParameter<T> param) { return (RParameter<T>) cParameterCache.put(param); }
/** * Returns a canonical instance, creating a new one if there isn't one * already in the cache. */ @SuppressWarnings("unchecked") private static <S extends Storable> ExistsFilter<S> getCanonical(ChainedProperty<S> property, Filter<?> subFilter, boolean not) { return (ExistsFilter<S>) cCanonical.put(new ExistsFilter<S>(property, subFilter, not)); }
/** * Returns a canonical instance which has no chain. * * @throws IllegalArgumentException if prime is null */ @SuppressWarnings("unchecked") public static <S extends Storable> ChainedProperty<S> get(StorableProperty<S> prime) { return (ChainedProperty<S>) cCanonical.put(new ChainedProperty<S>(prime, null, null)); }
/** * Returns a canonical instance. * * @throws IllegalArgumentException if either filter is null */ @SuppressWarnings("unchecked") static <S extends Storable> AndFilter<S> getCanonical(Filter<S> left, Filter<S> right) { return (AndFilter<S>) cCanonical.put(new AndFilter<S>(left, right)); }
/** * Returns a canonical instance. * * @throws IllegalArgumentException if property is null */ @SuppressWarnings("unchecked") public static <S extends Storable> OrderedProperty<S> get(ChainedProperty<S> property, Direction direction) { return (OrderedProperty<S>) cCanonical.put(new OrderedProperty<S>(property, direction)); }