Package org.cadixdev.lorenz.merge
Class MergeContext
- java.lang.Object
-
- org.cadixdev.lorenz.merge.MergeContext
-
public class MergeContext extends java.lang.ObjectThis class represents the current context for a remapping operation for a
MappingSetMergerHandler. This allows implementers ofMappingSetMergerHandlers access to each of the 4 combinations of mappings for a merge:- The left mapping set
- The right mapping set
- The reverse of the left mapping set
- The reverse of the right mapping set
This class represents a performance advantage for retrieving the reverse of the mappings as well, as it only computes the value of the reverse mapping set when requested, and only computes the value once per merge session.
This class is thread safe and all methods are reentrant.
- Since:
- 0.5.4
-
-
Constructor Summary
Constructors Constructor Description MergeContext(MappingSet left, MappingSet right)Create a newMappingSetmerge context.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MappingSetgetLeft()MappingSetgetLeftReversed()MappingSetgetRight()MappingSetgetRightReversed()
-
-
-
Constructor Detail
-
MergeContext
public MergeContext(MappingSet left, MappingSet right)
Create a newMappingSetmerge context. Provide the left and right mapping sets for the merge, neither may benull.- Parameters:
left- Theleftmapping set, must not benull.right- Therightmapping set, must not benull.
-
-
Method Detail
-
getLeft
public MappingSet getLeft()
- Returns:
- The
leftMappingSetfor the merge operation, notnull.
-
getRight
public MappingSet getRight()
- Returns:
- The
rightMappingSetfor the merge operation, notnull.
-
getLeftReversed
public MappingSet getLeftReversed()
- Returns:
- The
rightMappingSetfor the merge operation, but reversed. Nevernull. This method computes the value on first query and caches the result, making it more efficient than callingMappingSet.reverse()yourself.
-
getRightReversed
public MappingSet getRightReversed()
- Returns:
- The
rightMappingSetfor the merge operation, but reversed. Nevernull. This method computes the value on first query and caches the result, making it more efficient than callingMappingSet.reverse()yourself.
-
-