Package jromp.parallel.var
Class ReductionVariable<T extends Serializable>
java.lang.Object
jromp.parallel.var.ReductionVariable<T>
- Type Parameters:
T
- the type of the variable.
- All Implemented Interfaces:
Serializable
,Variable<T>
Represents a reduction variable that its value is reduced from private variables using a reduction operation.
- See Also:
-
Constructor Summary
ConstructorDescriptionReductionVariable
(ReductionOperation<T> operation, T initialValue) Constructs a new reduction variable with the given reduction operation and initial 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.boolean
isMerged()
void
merge()
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
-
ReductionVariable
Constructs a new reduction variable with the given reduction operation and initial value.- Parameters:
operation
- the reduction operation.initialValue
- the initial value of the reduction 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>
-
isMerged
public boolean isMerged() -
merge
public void merge() -
toString
-