Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
AspectJ tools most notably contains the AspectJ compiler (AJC). AJC applies aspects to Java classes during
compilation, fully replacing Javac for plain Java classes and also compiling native AspectJ or annotation-based
@AspectJ syntax. Furthermore, AJC can weave aspects into existing class files in a post-compile binary weaving step.
This library is a superset of AspectJ weaver and hence also of AspectJ runtime.
/**
* Copyright 2001-2004 The Apache Software Foundation
* Portions (modifications) Copyright 2004-2010 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* Apache Software Foundation - Initial implementation
* Pascal Rapicault, IBM - Pascal remove the entrySet() implementation because it relied on another class.
* IBM - change to int keys, remove support for weak references, and remove unused methods
* Rafik Jaouani - fix for the timing problem in case an item with the same key is added (bug 205117)
*/
package org.eclipse.core.internal.registry;
import java.lang.ref.*;
/**
* Hashtable-based map with integer keys that allows values to be removed
* by the garbage collector.
*
* When you construct a ReferenceMap, you can
* specify what kind of references are used to store the
* map's values. If non-hard references are
* used, then the garbage collector can remove mappings
* if a value becomes unreachable, or if the
* JVM's memory is running low. For information on how
* the different reference types behave, see
* {@link Reference}.
*
* The algorithms used are basically the same as those
* in {@link java.util.HashMap}. In particular, you
* can specify a load factor and capacity to suit your
* needs.
*
* This map does not allow null values. Attempting to add a null
* value to the map will raise a NullPointerException.
*
* This data structure is not synchronized.
*
* @see java.lang.ref.Reference
*/
public class ReferenceMap {
/**
* IEntry implementation that acts as a hard reference.
* The value of a hard reference entry is never garbage
* collected until it is explicitly removed from the map.
*/
private static class HardRef implements IEntry {
private final int key;
private IEntry next;
/**
* Reference value. Note this can never be null.
*/
private final Object value;
public HardRef(int key, Object value, IEntry next) {
this.key = key;
this.value = value;
this.next = next;
}
@Override
public int getKey() {
return key;
}
@Override
public IEntry getNext() {
return next;
}
@Override
public Object getValue() {
return value;
}
@Override
public void setNext(IEntry next) {
this.next = next;
}
@Override
public String toString() {
return "HardRef(" + key + ',' + value + ')'; //$NON-NLS-1$
}
}
/**
* The common interface for all elements in the map. Both
* hard and soft map values conform to this interface.
*/
private static interface IEntry {
/**
* Returns the integer key for this entry.
* @return The integer key
*/
public int getKey();
/**
* Returns the next entry in the linked list of entries
* with the same hash value, or null
* if there is no next entry.
* @return The next entry, or null.
*/
public IEntry getNext();
/**
* Returns the value of this entry.
* @return The entry value.
*/
public Object getValue();
/**
* Sets the next entry in the linked list of map entries
* with the same hash value.
*
* @param next The next entry, or null.
*/
public void setNext(IEntry next);
}
/**
* Augments a normal soft reference with additional information
* required to implement the IEntry interface.
*/
private static class SoftRef extends SoftReference