Package jromp.parallel.var
Class PrivateVariable<T extends Serializable>
java.lang.Object
jromp.parallel.var.PrivateVariable<T>
- Type Parameters:
T
- the type of the variable.
- All Implemented Interfaces:
Serializable
,Variable<T>
A variable that is not shared between threads.
It is initialized with the given value.
- See Also:
-
Constructor Summary
ConstructorDescriptionPrivateVariable
(T value) Constructs a new private variable with the given value. -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Creates a copy of the variable.void
end()
Performs any cleanup operations that may be required by the variable.void
Sets the value of the variable.toString()
void
update
(UnaryOperator<T> operator) Applies the givenUnaryOperator
to update the value of the variable.value()
Retrieves the value of the variable.
-
Constructor Details
-
PrivateVariable
Constructs a new private variable with the given value.- Parameters:
value
- the value of the variable.
-
-
Method Details
-
value
Description copied from interface:Variable
Retrieves the value of the variable.- Specified by:
value
in interfaceVariable<T extends Serializable>
- Returns:
- the value of the variable.
-
set
Description copied from interface:Variable
Sets the value of the variable.- Specified by:
set
in interfaceVariable<T extends Serializable>
- Parameters:
value
- the new value to be set.
-
update
Description copied from interface:Variable
Applies the givenUnaryOperator
to update the value of the variable.- Specified by:
update
in interfaceVariable<T extends Serializable>
- Parameters:
operator
- the unary operator to apply.
-
copy
Description copied from interface:Variable
Creates a copy of the variable.- Specified by:
copy
in interfaceVariable<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 interfaceVariable<T extends Serializable>
-
toString
-