/** * Creates a new entry object for the ReferenceMap. * * @param parent the parent map * @param next the next entry in the hash bucket * @param hashCode the hash code of the key * @param key the key * @param value the value */ public ReferenceEntry(AbstractReferenceMap<K, V> parent, ReferenceEntry<K, V> next, int hashCode, K key, V value) { super(next, hashCode, null, null); this.parent = parent; if (parent.keyType != HARD) { refKey = toReference(parent.keyType, key, hashCode); } else { this.setKey(key); } if (parent.valueType != HARD) { refValue = toReference(parent.valueType, value, hashCode); // the key hashCode is passed in deliberately } else { this.setValue(value); } }
/** * Creates a new entry object for the ReferenceMap. * * @param parent the parent map * @param next the next entry in the hash bucket * @param hashCode the hash code of the key * @param key the key * @param value the value */ public ReferenceEntry(AbstractReferenceMap<K, V> parent, ReferenceEntry<K, V> next, int hashCode, K key, V value) { super(next, hashCode, null, null); this.parent = parent; if (parent.keyType != HARD) { refKey = toReference(parent.keyType, key, hashCode); } else { this.setKey(key); } if (parent.valueType != HARD) { refValue = toReference(parent.valueType, value, hashCode); // the key hashCode is passed in deliberately } else { this.setValue(value); } }
/** * Purges the specified reference * * @param ref the reference to purge * @return true or false */ boolean purge(Reference ref) { boolean r = (parent.keyType > HARD) && (refKey == ref); r = r || ((parent.valueType > HARD) && (refValue == ref)); if (r) { if (parent.keyType > HARD) { refKey.clear(); } if (parent.valueType > HARD) { refValue.clear(); } else if (parent.purgeValues) { setValue(null); } } return r; }
/** * Creates a new entry object for the ReferenceMap. * * @param parent the parent map * @param next the next entry in the hash bucket * @param hashCode the hash code of the key * @param key the key * @param value the value */ public ReferenceEntry(AbstractReferenceMap<K, V> parent, ReferenceEntry<K, V> next, int hashCode, K key, V value) { super(next, hashCode, null, null); this.parent = parent; if (parent.keyType != HARD) { refKey = toReference(parent.keyType, key, hashCode); } else { this.setKey(key); } if (parent.valueType != HARD) { refValue = toReference(parent.valueType, value, hashCode); // the key hashCode is passed in deliberately } else { this.setValue(value); } }
/** * Purges the specified reference * * @param ref the reference to purge * @return true or false */ boolean purge(Reference ref) { boolean r = (parent.keyType > HARD) && (refKey == ref); r = r || ((parent.valueType > HARD) && (refValue == ref)); if (r) { if (parent.keyType > HARD) { refKey.clear(); } if (parent.valueType > HARD) { refValue.clear(); } else if (parent.purgeValues) { setValue(null); } } return r; }
/** * Purges the specified reference * * @param ref the reference to purge * @return true or false */ boolean purge(Reference ref) { boolean r = (parent.keyType > HARD) && (refKey == ref); r = r || ((parent.valueType > HARD) && (refValue == ref)); if (r) { if (parent.keyType > HARD) { refKey.clear(); } if (parent.valueType > HARD) { refValue.clear(); } else if (parent.purgeValues) { setValue(null); } } return r; }