Class ComparisonContext

  • All Implemented Interfaces:
    AutoCloseable

    public class ComparisonContext
    extends Object
    implements AutoCloseable
    ComparisonContext is able to store comparison-specific information for a single object comparison computation being performed at the moment. As comparison algorithms could affect other objects, the context is not limited to store data related to the main target of the comparison process.
    Each IComparisonParticipant could register its own set of IObjectComparisonContext's during the processing.
    The ComparisonContext is being created automatically at the beginning of the object comparison process and being disposed at the end of the comparison process.
    • Constructor Detail

      • ComparisonContext

        public ComparisonContext​(IComparisonSession comparisonSession)
        Creates context instance.
        Parameters:
        comparisonSession - the comparison session, cannot be null
    • Method Detail

      • addObjectContext

        public void addObjectContext​(long topNodeId,
                                     IObjectComparisonContext objectContext)
        Adds a IObjectComparisonContext to this context for the given top comparison node.
        Parameters:
        topNodeId - the top comparison node identifier to add object context for
        objectContext - The object context to add. Can't be null
      • getComparisonTransaction

        public IBmTransaction getComparisonTransaction()
        Gets the comparison transaction associated with the context
        Returns:
        The transaction for the current comparison. Can be null
      • getComparisonSession

        public IComparisonSession getComparisonSession()
        Gets the comparison session the context attached to.
        Returns:
        the comparison session, cannot be null
      • getObjectContext

        public IObjectComparisonContext getObjectContext​(long topNodeId)
        Gets a IObjectComparisonContext being stored in the context for the given top comparison node.
        Parameters:
        topNodeId - the top comparison node identifier to get object context for
        Returns:
        The stored object context. Can be null
      • getBatchSessionHandle

        public Object getBatchSessionHandle()
        Gets the batch session handle.
        Returns:
        the batch session handle. Can be null.
      • setComparisonTransaction

        public void setComparisonTransaction​(IBmTransaction comparisonTransaction)
        Sets the comparison transaction.
        Parameters:
        The - transaction for the current comparison. Can be null
      • setBatchSessionHandle

        public void setBatchSessionHandle​(Object batchSessionHandle)
        Sets the batch session handle.
        Parameters:
        batchSessionHandle - the batch session handle, can be null.
        See Also:
        IBmModel.beginBatchSession()
      • close

        public void close()
        Closes the context, cleaning/committing all underlying data.
        Specified by:
        close in interface AutoCloseable