cz.cuni.amis.utils.concurrency
Class AtomicLongList

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

public class AtomicLongList
extends Object


Constructor Summary
AtomicLongList(int initialCapacity, int capacityStep)
           
 
Method Summary
 long addAndGet(int i, long delta)
          Atomically add the given value to element at index i.
 int capacity()
          Returns current capacity of the array.
 boolean compareAndSet(int i, long expect, long update)
          Atomically set the value to the given updated value if the current value == the expected value.
 long decrementAndGet(int i)
          Atomically decrement by one the element at index i.
 long get(int i)
          Get the current value at position i.
 long getAndAdd(int i, long delta)
          Atomically add the given value to element at index i.
 long getAndDecrement(int i)
          Atomically decrement by one the element at index i.
 long getAndIncrement(int i)
          Atomically increment by one the element at index i.
 long getAndSet(int i, long newValue)
          Set the element at position i to the given value and return the old value.
 long incrementAndGet(int i)
          Atomically increment by one the element at index i.
 void set(int i, long 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, long expect, long 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

AtomicLongList

public AtomicLongList(int initialCapacity,
                      int capacityStep)
Method Detail

addAndGet

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

Parameters:
i -
delta -
Returns:

compareAndSet

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

Parameters:
i -
expect -
update -
Returns:

decrementAndGet

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

Parameters:
i -
Returns:

get

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

Parameters:
i -
Returns:

getAndAdd

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

Parameters:
i -
delta -
Returns:

getAndDecrement

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

Parameters:
i -
Returns:

getAndIncrement

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

Parameters:
i -
Returns:

getAndSet

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

Parameters:
i -
newValue -
Returns:

incrementAndGet

public long 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,
                long newValue)
Set the element at position i to the given value.

Parameters:
i -
newValue -

weakCompareAndSet

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

Parameters:
i -
expect -
update -
Returns:


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