Package jromp.parallel.var
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>
A variable that performs atomic operations over its value.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAtomicVariable(T value) Constructs a new atomic variable with the given value. -
Method Summary
Modifier and TypeMethodDescriptioncopy()Creates a copy of the variable.voidend()Performs any cleanup operations that may be required by the variable.voidSets the value of the variable.toString()voidupdate(UnaryOperator<T> operator) Applies the givenUnaryOperatorto update the value of the variable.value()Retrieves the value of the variable.
-
Constructor Details
-
AtomicVariable
Constructs a new atomic variable with the given value.- Parameters:
value- the value of the variable.
-
-
Method Details
-
value
Description copied from interface:VariableRetrieves the value of the variable.- Specified by:
valuein interfaceVariable<T extends Serializable>- Returns:
- the value of the variable.
-
set
Description copied from interface:VariableSets the value of the variable.- Specified by:
setin interfaceVariable<T extends Serializable>- Parameters:
value- the new value to be set.
-
update
Description copied from interface:VariableApplies the givenUnaryOperatorto update the value of the variable.- Specified by:
updatein interfaceVariable<T extends Serializable>- Parameters:
operator- the unary operator to apply.
-
copy
Description copied from interface:VariableCreates a copy of the variable.- Specified by:
copyin interfaceVariable<T extends Serializable>- Returns:
- a copy of the variable.
-
end
public void end()Description copied from interface:VariablePerforms any cleanup operations that may be required by the variable.- Specified by:
endin interfaceVariable<T extends Serializable>
-
toString
-