org.glassfish.hk2.utilities.general.internal.DoubleNode Maven / Gradle / Ivy
/*
* Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package org.glassfish.hk2.utilities.general.internal;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
/**
* Used for doubly linked lists with weak keys
*
* @author jwells
*
* @param key
* @param value
*/
public class DoubleNode {
private final WeakReference weakKey;
private final V value;
private DoubleNode previous;
private DoubleNode next;
private K hardenedKey;
public DoubleNode(K key, V value, ReferenceQueue super K> queue) {
weakKey = new WeakReference(key, queue);
this.value = value;
}
/**
* @return the previous
*/
public DoubleNode getPrevious() {
return previous;
}
/**
* @param previous the previous to set
*/
public void setPrevious(DoubleNode previous) {
this.previous = previous;
}
/**
* @return the next
*/
public DoubleNode getNext() {
return next;
}
/**
* @param next the next to set
*/
public void setNext(DoubleNode next) {
this.next = next;
}
/**
* @return the weakKey
*/
public WeakReference getWeakKey() {
return weakKey;
}
/**
* @return the value
*/
public V getValue() {
return value;
}
/**
* @return the hardenedKey
*/
public K getHardenedKey() {
return hardenedKey;
}
/**
* @param hardenedKey the hardenedKey to set
*/
public void setHardenedKey(K hardenedKey) {
this.hardenedKey = hardenedKey;
}
}