Class AbstractMdObjectMatcher<T>

  • Type Parameters:
    T - the type of objects to match
    Direct Known Subclasses:
    ChildMdObjectMatcher, TopObjectMatcher

    public abstract class AbstractMdObjectMatcher<T>
    extends Object
    An abstract matcher of objects representing MD objects, capable of creating comparison result nodes.
    • Constructor Detail

      • AbstractMdObjectMatcher

        protected AbstractMdObjectMatcher​(IComparisonSession session,
                                          MdCollectionComparisonNode parentCollectionNode,
                                          List<T> mainObjects,
                                          List<T> otherObjects,
                                          List<T> ancestorObjects)
        Constructs a matcher.
        Parameters:
        session - the comparison session, cannot be null
        parentCollectionNode - the node related to the parent collection where the matching MD objects lie in, may be null if objects don't lie in any collection
        mainObjects - the main objects to be matched, cannot be null
        otherObjects - the other objects to be matched, cannot be null
        ancestorObjects - the ancestor objects to be matched, may be null in case of two-way comparison
    • Method Detail

      • match

        public List<MdObjectComparisonNode> match()
        Matches the specified collections and returns the result as a list of created child model nodes.
        Returns:
        a list of created child nodes corresponding to matched objects, never null
      • getName

        protected abstract String getName​(T object)
        Returns the name of the matched object.
        Returns:
        the name
      • getUuid

        protected abstract UUID getUuid​(T object)
        Returns the UUID of the matched object.
        Returns:
        the UUID
      • getSymlink

        protected abstract String getSymlink​(T object)
        Returns the symbolic link of the matched object.
        Returns:
        the symbolic link
      • createNode

        protected abstract MdObjectComparisonNode createNode​(T main,
                                                             T other,
                                                             T ancestor)
        Creates a comparison node for the triple of matched objects. At least one of objects in the triple must not be null.
        Parameters:
        main - the main object, may be null
        other - the other object, may be null
        ancestor - the common ancestor object, may be null
        Returns:
        a new comparison node related to the triple of objects, never null
      • getSession

        protected IComparisonSession getSession()
        Returns the comparison session.
        Returns:
        the comparison session instance, never null
      • getParentCollectionFeature

        protected org.eclipse.emf.ecore.EStructuralFeature getParentCollectionFeature()
        Gets parent collection feature, if present.
        Returns:
        the parent collection feature, may be null
      • checkOrderChange

        protected boolean checkOrderChange()
        Tells whether to check the md objects order change.
        Returns:
        true if should check the md objects order change, false otherwise