<T> R<T> findResult(ProxyLookup proxy, ImmutableInternalData[] newData, Template<T> template) { assert Thread.holdsLock(proxy); Map<Template,Reference<R>> map = getResults(); Reference<R> ref = map.get(template); R r = (ref == null) ? null : ref.get(); if (r != null) { newData[0] = this; return convertResult(r); } HashMap<Template, Reference<R>> res = new HashMap<Template, Reference<R>>(map); R<T> newR = new R<T>(proxy, template); res.put(template, new java.lang.ref.SoftReference<R>(newR)); newR.data = newData[0] = create(getRawLookups(), res); return newR; } final ImmutableInternalData setLookupsNoFire(Lookup[] lookups, boolean skipCheck) {
final <T> ImmutableInternalData removeTemplate(ProxyLookup proxy, Template<T> template) { if (getResults().containsKey(template)) { HashMap<Template,Reference<R>> c = new HashMap<Template, Reference<ProxyLookup.R>>(getResults()); Reference<R> ref = c.remove(template); if (ref != null && ref.get() != null) { // seems like there is a reference to a result for this template // thta is still alive return this; } return create(getRawLookups(), c); } else { return this; } }
<T> R<T> findResult(ProxyLookup proxy, ImmutableInternalData[] newData, Template<T> template) { assert Thread.holdsLock(proxy); Map<Template,Reference<R>> map = getResults(); Reference<R> ref = map.get(template); R r = (ref == null) ? null : ref.get(); if (r != null) { newData[0] = this; return convertResult(r); } HashMap<Template, Reference<R>> res = new HashMap<Template, Reference<R>>(map); R<T> newR = new R<T>(proxy, template); res.put(template, new java.lang.ref.SoftReference<R>(newR)); newR.data = newData[0] = create(getRawLookups(), res); return newR; } final ImmutableInternalData setLookupsNoFire(Lookup[] lookups, boolean skipCheck) {
<T> R<T> findResult(ProxyLookup proxy, ImmutableInternalData[] newData, Template<T> template) { assert Thread.holdsLock(proxy); Map<Template,Reference<R>> map = getResults(); Reference<R> ref = map.get(template); R r = (ref == null) ? null : ref.get(); if (r != null) { newData[0] = this; return convertResult(r); } HashMap<Template, Reference<R>> res = new HashMap<Template, Reference<R>>(map); R<T> newR = new R<T>(proxy, template); res.put(template, new java.lang.ref.SoftReference<R>(newR)); newR.data = newData[0] = create(getRawLookups(), res); return newR; } final ImmutableInternalData setLookupsNoFire(Lookup[] lookups, boolean skipCheck) {
final <T> ImmutableInternalData removeTemplate(ProxyLookup proxy, Template<T> template) { if (getResults().containsKey(template)) { HashMap<Template,Reference<R>> c = new HashMap<Template, Reference<ProxyLookup.R>>(getResults()); Reference<R> ref = c.remove(template); if (ref != null && ref.get() != null) { // seems like there is a reference to a result for this template // thta is still alive return this; } return create(getRawLookups(), c); } else { return this; } }
final <T> ImmutableInternalData removeTemplate(ProxyLookup proxy, Template<T> template) { if (getResults().containsKey(template)) { HashMap<Template,Reference<R>> c = new HashMap<Template, Reference<ProxyLookup.R>>(getResults()); Reference<R> ref = c.remove(template); if (ref != null && ref.get() != null) { // seems like there is a reference to a result for this template // thta is still alive return this; } return create(getRawLookups(), c); } else { return this; } }
final Lookup[] getLookups(boolean clone) { Object l = this.getRawLookups(); if (l instanceof Lookup) { return new Lookup[] { (Lookup)l }; } else { Lookup[] arr = (Lookup[])l; if (clone) { arr = arr.clone(); } return arr; } } final List<Lookup> getLookupsList() {
final Lookup[] getLookups(boolean clone) { Object l = this.getRawLookups(); if (l instanceof Lookup) { return new Lookup[] { (Lookup)l }; } else { Lookup[] arr = (Lookup[])l; if (clone) { arr = arr.clone(); } return arr; } } final List<Lookup> getLookupsList() {
final Lookup[] getLookups(boolean clone) { Object l = this.getRawLookups(); if (l instanceof Lookup) { return new Lookup[] { (Lookup)l }; } else { Lookup[] arr = (Lookup[])l; if (clone) { arr = arr.clone(); } return arr; } } final List<Lookup> getLookupsList() {