Example usage for java.util.concurrent.atomic AtomicIntegerArray AtomicIntegerArray

List of usage examples for java.util.concurrent.atomic AtomicIntegerArray AtomicIntegerArray

Introduction

In this page you can find the example usage for java.util.concurrent.atomic AtomicIntegerArray AtomicIntegerArray.

Prototype

public AtomicIntegerArray(int[] array) 

Source Link

Document

Creates a new AtomicIntegerArray with the same length as, and all elements copied from, the given array.

Usage

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));
}