Class AbstractBmReferencesCollectorVisitorCallback

  • All Implemented Interfaces:
    IEObjectVisitorCallback

    public abstract class AbstractBmReferencesCollectorVisitorCallback
    extends Object
    implements IEObjectVisitorCallback
    The abstract IEObjectVisitorCallback implementation.
    It collects BM object cross references and processes it. Successors should implement processReferences(IBmObject, Collection) method to provide processing feature.
    The example below iterates over cross references and prints it to console.
    {@code
          IEObjectVisitorCallback callback = new AbstractBmReferencesCollectorVisitorCallback(bmModel, dependentModels)
            {
    • Constructor Detail

      • AbstractBmReferencesCollectorVisitorCallback

        public AbstractBmReferencesCollectorVisitorCallback​(IBmModel bmModel,
                                                            Collection<IBmModel> dependentModels)
        Creates a new instance.
        Parameters:
        bmModel - the IBmModel, cannot be null.
        dependentModels - the collection of dependent models, cannot be null.
    • Method Detail

      • visit

        public void visit​(org.eclipse.emf.ecore.EObject eObject)
        Description copied from interface: IEObjectVisitorCallback
        Visits the specified eObject.
        Specified by:
        visit in interface IEObjectVisitorCallback
        Parameters:
        eObject - the EObject instance, cannot be null.
      • getBmModel

        protected final IBmModel getBmModel()
        Returns the BM model.
        Returns:
        the BM model, never null.
      • getDependentModels

        protected final Collection<IBmModel> getDependentModels()
        Returns a collection of dependent BM models.
        Returns:
        a collection of dependent BM models, never null.
      • isBmObject

        protected final boolean isBmObject​(org.eclipse.emf.ecore.EObject object)
        Checks if the specified object is BM object. It means that object is instance of IBmObject and its engine is not null.
        Parameters:
        object - the object to check, cannot be null.
        Returns:
        true if the specified object is BM object, false - otherwise.
      • checkReference

        protected boolean checkReference​(IBmModel bmModel,
                                         IBmCrossReference reference)
        Checks the IBmCrossReference during collecting, before processing. By default it does nothing.
        Parameters:
        bmModel - the BM model, cannot be null.
        reference - the reference to check, cannot be null.
        Returns:
        true if the references is checked and should be processed, false - otherwise.
      • processReferences

        protected abstract void processReferences​(IBmObject bmObject,
                                                  Collection<BmModelCrossReference> references)
        Process the references for the specified bmObject.
        Parameters:
        bmObject - the BM object, cannot be null.
        references - the references, cannot be null.