cz.cuni.amis.utils.concurrency
Class AtomicIntegerList

Package class diagram package AtomicIntegerList
java.lang.Object
  extended by cz.cuni.amis.utils.concurrency.AtomicIntegerList

public class AtomicIntegerList
extends Object


Constructor Summary
AtomicIntegerList(int initialCapacity, int capacityStep)
           
 
Method Summary
 int addAndGet(int i, int delta)
          Atomically add the given value to element at index i.
 int capacity()
          Returns current capacity of the array.
 boolean compareAndSet(int i, int expect, int update)
          Atomically set the value to the given updated value if the current value == the expected value.
 int decrementAndGet(int i)
          Atomically decrement by one the element at index i.
 int get(int i)
          Get the current value at position i.
 int getAndAdd(int i, int delta)
          Atomically add the given value to element at index i.
 int getAndDecrement(int i)
          Atomically decrement by one the element at index i.
 int getAndIncrement(int i)
          Atomically increment by one the element at index i.
 int getAndSet(int i, int newValue)
          Set the element at position i to the given value and return the old value.
 int incrementAndGet(int i)
          Atomically increment by one the element at index i.
 void set(int i, int newValue)
          Set the element at position i to the given value.
 int size()
          Returns the length of the array (== max-touched-index+1).
 boolean weakCompareAndSet(int i, int expect, int update)
          Atomically set the value to the given updated value if the current value == the expected value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AtomicIntegerList

public AtomicIntegerList(int initialCapacity,
                         int capacityStep)
Method Detail

addAndGet

public int addAndGet(int i,
                     int delta)
Atomically add the given value to element at index i.

Parameters:
i -
delta -
Returns:

compareAndSet

public boolean compareAndSet(int i,
                             int expect,
                             int update)
Atomically set the value to the given updated value if the current value == the expected value.

Parameters:
i -
expect -
update -
Returns:

decrementAndGet

public int decrementAndGet(int i)
Atomically decrement by one the element at index i.

Parameters:
i -
Returns:

get

public int get(int i)
Get the current value at position i.

Parameters:
i -
Returns:

getAndAdd

public int getAndAdd(int i,
                     int delta)
Atomically add the given value to element at index i.

Parameters:
i -
delta -
Returns:

getAndDecrement

public int getAndDecrement(int i)
Atomically decrement by one the element at index i.

Parameters:
i -
Returns:

getAndIncrement

public int getAndIncrement(int i)
Atomically increment by one the element at index i.

Parameters:
i -
Returns:

getAndSet

public int getAndSet(int i,
                     int newValue)
Set the element at position i to the given value and return the old value.

Parameters:
i -
newValue -
Returns:

incrementAndGet

public int incrementAndGet(int i)
Atomically increment by one the element at index i.

Parameters:
i -
Returns:

size

public int size()
Returns the length of the array (== max-touched-index+1).

Returns:

capacity

public int capacity()
Returns current capacity of the array.

Returns:

set

public void set(int i,
                int newValue)
Set the element at position i to the given value.

Parameters:
i -
newValue -

weakCompareAndSet

public boolean weakCompareAndSet(int i,
                                 int expect,
                                 int update)
Atomically set the value to the given updated value if the current value == the expected value.

Parameters:
i -
expect -
update -
Returns:


Copyright © 2013 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.