Class AtomicVariable<T extends Serializable>

java.lang.Object
jromp.parallel.var.AtomicVariable<T>
Type Parameters:
T - the type of the variable.
All Implemented Interfaces:
Serializable, Variable<T>

public class AtomicVariable<T extends Serializable> extends Object implements Variable<T>
A variable that performs atomic operations over its value.
See Also:
  • Constructor Details

    • AtomicVariable

      public AtomicVariable(T value)
      Constructs a new atomic variable with the given value.
      Parameters:
      value - the value of the variable.
  • Method Details

    • value

      public T value()
      Description copied from interface: Variable
      Retrieves the value of the variable.
      Specified by:
      value in interface Variable<T extends Serializable>
      Returns:
      the value of the variable.
    • set

      public void set(T value)
      Description copied from interface: Variable
      Sets the value of the variable.
      Specified by:
      set in interface Variable<T extends Serializable>
      Parameters:
      value - the new value to be set.
    • update

      public void update(UnaryOperator<T> operator)
      Description copied from interface: Variable
      Applies the given UnaryOperator to update the value of the variable.
      Specified by:
      update in interface Variable<T extends Serializable>
      Parameters:
      operator - the unary operator to apply.
    • copy

      public Variable<T> copy()
      Description copied from interface: Variable
      Creates a copy of the variable.
      Specified by:
      copy in interface Variable<T extends Serializable>
      Returns:
      a copy of the variable.
    • end

      public void end()
      Description copied from interface: Variable
      Performs any cleanup operations that may be required by the variable.
      Specified by:
      end in interface Variable<T extends Serializable>
    • toString

      public String toString()
      Overrides:
      toString in class Object