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
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 TypeMethodDescriptionvoid
end()
Performs any cleanup operations that may be required by the variable.void
Sets the value of the variable.void
update
(UnaryOperator<T> operator) Applies the givenUnaryOperator
to update the value of the variable.default void
Updates the value of the variable using the given operation.value()
Retrieves the value of the variable.
-
Method Details
-
value
T value()Retrieves the value of the variable.- Returns:
- the value of the variable.
-
set
Sets the value of the variable.- Parameters:
value
- the new value to be set.
-
update
Applies the givenUnaryOperator
to update the value of the variable.- Parameters:
operator
- the unary operator to apply.
-
update
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.
-