Package jromp.var

Interface Variable<T extends Serializable>

Type Parameters:
T - the type of the variable.
All Superinterfaces:
Serializable
All Known Implementing Classes:
AtomicVariable, FirstPrivateVariable, LastPrivateVariable, PrivateVariable, ReductionVariable, SharedVariable, ThreadPrivateVariable

public interface Variable<T extends Serializable> extends Serializable
The Variable interface represents a variable that can store a value of any type. It provides methods to get and set the value, update the value using a UnaryOperator and create a copy of the variable.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    end()
    Performs any cleanup operations that may be required by the variable.
    void
    set(T value)
    Sets the value of the variable.
    void
    update(UnaryOperator<T> operator)
    Applies the given UnaryOperator to update the value of the variable.
    default void
    update(Operation<T> operation)
    Updates the value of the variable using the given operation.
    Retrieves the value of the variable.
  • Method Details

    • value

      T value()
      Retrieves the value of the variable.
      Returns:
      the value of the variable.
    • set

      void set(T value)
      Sets the value of the variable.
      Parameters:
      value - the new value to be set.
    • update

      void update(UnaryOperator<T> operator)
      Applies the given UnaryOperator to update the value of the variable.
      Parameters:
      operator - the unary operator to apply.
    • update

      default void update(Operation<T> operation)
      Updates the value of the variable using the given operation.
      Parameters:
      operation - the operation to apply.
    • end

      void end()
      Performs any cleanup operations that may be required by the variable.