List of usage examples for java.util.concurrent.atomic AtomicIntegerArray AtomicIntegerArray
public AtomicIntegerArray(int[] array)
From source file:org.spout.api.util.StringMap.java
/** * @param parent the parent of this map/*from w w w.ja v a 2 s . c o m*/ * @param store the store to store ids * @param minId the lowest valid id for dynamic allocation (ids below this are assumed to be reserved) * @param maxId the highest valid id + 1 * @param name The name of this StringMap */ public StringMap(StringMap parent, SimpleStore<Integer> store, int minId, int maxId, String name) { this.parent = parent; this.store = store; if (this.parent != null) { thisToParentMap = new AtomicIntegerArray(maxId); parentToThisMap = new AtomicIntegerArray(maxId); for (int i = 0; i < maxId; i++) { thisToParentMap.set(i, 0); parentToThisMap.set(i, 0); } } else { thisToParentMap = null; parentToThisMap = null; } this.minId = minId; this.maxId = maxId; nextId = new AtomicInteger(minId); this.id = STRING_MAP_REGISTRATION.register(name); REGISTERED_MAPS.put(name, new WeakReference<StringMap>(this)); }