Class Finder.ByTypeRecursivelyFinder

  • Enclosing class:
    Finder

    public static final class Finder.ByTypeRecursivelyFinder
    extends java.lang.Object
    Search for all elements by element type in the given root element(s) and all(direct and indirect) children of root element(s)
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static boolean canStartConcurrentFind()  
      private static <T extends Element>
      java.util.Collection<T>
      concurrentFind​(com.nomagic.magicdraw.uml.FindFunction<T> finderFunction, java.util.Collection<? extends Element> roots, java.lang.Class[] types, boolean includeRoots, boolean includeAdditionalContents, org.eclipse.core.runtime.IProgressMonitor monitor)  
      private static org.eclipse.core.runtime.IProgressMonitor createMonitor​(org.eclipse.core.runtime.IProgressMonitor monitor)  
      <T extends Element>
      java.util.Collection<T>
      find​(Project project, java.lang.Class[] types)
      Collect all elements of given specific type (not super class or interface) from the project.
      <T extends Element>
      java.util.Collection<T>
      find​(Project project, java.lang.Class[] types, boolean includeRoots)
      Collect all elements of given specific type (not super class or interface) from the project
      <T extends Element>
      java.util.Collection<T>
      find​(Element root, java.lang.Class[] types)
      Collect all elements of given specific type (not super class or interface) from the root element.
      <T extends Element>
      java.util.Collection<T>
      find​(Element root, java.lang.Class[] types, boolean includeRoots)
      Collect all elements of given specific type (not super class or interface) from the root element.
      <T extends Element>
      java.util.Collection<T>
      find​(Element root, java.lang.Class[] types, boolean includeRoot, boolean includeAdditionalContents, org.eclipse.core.runtime.IProgressMonitor monitor)
      Collect all elements of given specific type (not super class or interface) from the root element.
      <T extends Element>
      java.util.Collection<T>
      find​(java.util.Collection<? extends Element> roots, java.lang.Class[] types, boolean includeRoots)
      Collect all elements of given specific type (not super class or interface) from the root element.
      <T extends Element>
      java.util.Collection<T>
      find​(java.util.Collection<? extends Element> roots, java.lang.Class[] types, boolean includeRoots, boolean includeAdditionalContents, org.eclipse.core.runtime.IProgressMonitor monitor)
      Collect all elements of given specific type (not super class or interface) from the root element.
      private static <T extends Element>
      java.util.Collection<T>
      internalFind​(java.util.Collection<? extends Element> roots, java.lang.Class[] types, boolean includeRoots, boolean includeAdditionalContents, boolean useConcurrentFind, org.eclipse.core.runtime.IProgressMonitor monitor)  
      private static <T extends Element>
      java.util.Collection<T>
      internalFindIgnoreName​(java.util.Collection<? extends Element> roots, java.lang.Class[] types, boolean includeRoots, boolean includeAdditionalContents, org.eclipse.core.runtime.IProgressMonitor monitor)  
      private static <T extends Element>
      CloseableIterator<T>
      internalIterator​(java.util.Collection<? extends Element> roots, java.lang.Class[] types, boolean includeRoot)  
      private static boolean isWholeNotEsiProject​(java.util.Collection<? extends Element> roots)  
      <T extends Element>
      CloseableIterator<T>
      iterator​(Project project, java.lang.Class[] types)
      Returns iterator which contains elements of given specific type (not super class or interface).
      <T extends Element>
      CloseableIterator<T>
      iterator​(Project project, java.lang.Class[] types, boolean includeRoot)
      Returns iterator which contains elements of given specific type (not super class or interface).
      <T extends Element>
      CloseableIterator<T>
      iterator​(Element root, java.lang.Class[] types)
      Returns iterator which contains elements of given specific type (not super class or interface).
      <T extends Element>
      CloseableIterator<T>
      iterator​(Element root, java.lang.Class[] types, boolean includeRoot)
      Returns iterator which contains elements of given specific type (not super class or interface).
      <T extends Element>
      CloseableIterator<T>
      iterator​(java.util.Collection<? extends Element> roots, java.lang.Class[] types)
      Returns iterator which contains elements of given specific type (not super class or interface).
      <T extends Element>
      CloseableIterator<T>
      iterator​(java.util.Collection<? extends Element> roots, java.lang.Class[] types, boolean includeRoot)
      Returns iterator which contains elements of given specific type (not super class or interface).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • threadPoolExecutor

        private static final java.util.concurrent.ThreadPoolExecutor threadPoolExecutor
      • SKIP_CONCURRENT_FIND

        private static final boolean SKIP_CONCURRENT_FIND
      • MAX_CONCURRENT_FIND

        private static final int MAX_CONCURRENT_FIND
    • Constructor Detail

      • ByTypeRecursivelyFinder

        private ByTypeRecursivelyFinder()
    • Method Detail

      • iterator

        public <T extends ElementCloseableIterator<T> iterator​(Element root,
                                                                 @CheckForNull
                                                                 java.lang.Class[] types)
        Returns iterator which contains elements of given specific type (not super class or interface). Search of elements is done from a given root element.
        Parameters:
        root - root element.
        types - element type. Null means any element
        Returns:
        iterator
      • iterator

        public <T extends ElementCloseableIterator<T> iterator​(Element root,
                                                                 @CheckForNull
                                                                 java.lang.Class[] types,
                                                                 boolean includeRoot)
        Returns iterator which contains elements of given specific type (not super class or interface). Search of elements is done from a given root element.
        Parameters:
        root - root element.
        types - element type. Null means any element
        includeRoot - include root into result
        Returns:
        iterator
      • iterator

        public <T extends ElementCloseableIterator<T> iterator​(java.util.Collection<? extends Element> roots,
                                                                 @CheckForNull
                                                                 java.lang.Class[] types)
        Returns iterator which contains elements of given specific type (not super class or interface). Search of elements is done from a given root element. Roots are included also.
        Parameters:
        roots - root elements.
        types - element type. Null means any element
        Returns:
        iterator
      • iterator

        public <T extends ElementCloseableIterator<T> iterator​(java.util.Collection<? extends Element> roots,
                                                                 @CheckForNull
                                                                 java.lang.Class[] types,
                                                                 boolean includeRoot)
        Returns iterator which contains elements of given specific type (not super class or interface). Search of elements is done from a given root element.
        Parameters:
        roots - root elements.
        types - element type. Null means any element
        includeRoot - include root elements into result
        Returns:
        iterator
      • iterator

        public <T extends ElementCloseableIterator<T> iterator​(Project project,
                                                                 @CheckForNull
                                                                 java.lang.Class[] types)
        Returns iterator which contains elements of given specific type (not super class or interface). Search of elements is done in whole project. Root models of project are included.
        Parameters:
        project - project
        types - element type. Null means any element
        Returns:
        iterator
      • iterator

        public <T extends ElementCloseableIterator<T> iterator​(Project project,
                                                                 @CheckForNull
                                                                 java.lang.Class[] types,
                                                                 boolean includeRoot)
        Returns iterator which contains elements of given specific type (not super class or interface). Search of elements is done in whole project
        Parameters:
        project - project
        types - element type. Null means any element
        includeRoot - include project root models into result
        Returns:
        iterator
      • find

        public <T extends Element> java.util.Collection<T> find​(Element root,
                                                                @CheckForNull
                                                                java.lang.Class[] types)
        Collect all elements of given specific type (not super class or interface) from the root element. Roots are also included
        Parameters:
        root - the root element for searching
        types - an array of Element's class types (Class.class, Package.class, Property.class and etc)
        Returns:
        found elements
      • find

        public <T extends Element> java.util.Collection<T> find​(Element root,
                                                                @CheckForNull
                                                                java.lang.Class[] types,
                                                                boolean includeRoots)
        Collect all elements of given specific type (not super class or interface) from the root element.
        Parameters:
        root - the root element for searching
        types - an array of Element's class types (Class.class, Package.class, Property.class and etc)
        includeRoots - include root elements into search results
        Returns:
        found elements
      • find

        public <T extends Element> java.util.Collection<T> find​(Project project,
                                                                @CheckForNull
                                                                java.lang.Class[] types)
        Collect all elements of given specific type (not super class or interface) from the project. Roots are also included.
        Parameters:
        project - project
        types - an array of Element's class types (Class.class, Package.class, Property.class and etc)
        Returns:
        found elements
      • find

        public <T extends Element> java.util.Collection<T> find​(Project project,
                                                                @CheckForNull
                                                                java.lang.Class[] types,
                                                                boolean includeRoots)
        Collect all elements of given specific type (not super class or interface) from the project
        Parameters:
        project - project
        types - an array of Element's class types (Class.class, Package.class, Property.class and etc)
        includeRoots - include root models of project into search results
        Returns:
        found elements
      • find

        public <T extends Element> java.util.Collection<T> find​(Element root,
                                                                @CheckForNull
                                                                java.lang.Class[] types,
                                                                boolean includeRoot,
                                                                boolean includeAdditionalContents,
                                                                @CheckForNull
                                                                org.eclipse.core.runtime.IProgressMonitor monitor)
        Collect all elements of given specific type (not super class or interface) from the root element.
        Parameters:
        root - the root element for searching
        types - an array of Element's class types (Class.class, Package.class, Property.class and etc)
        includeRoot - include root elements into search results
        includeAdditionalContents - include additional content of Element defined in DSL
        monitor - progress monitor
        Returns:
        found elements
      • find

        public <T extends Element> java.util.Collection<T> find​(java.util.Collection<? extends Element> roots,
                                                                @CheckForNull
                                                                java.lang.Class[] types,
                                                                boolean includeRoots)
        Collect all elements of given specific type (not super class or interface) from the root element.
        Parameters:
        roots - the root element for searching
        types - an array of Element's class types (Class.class, Package.class, Property.class and etc)
        includeRoots - include root elements into search results
        Returns:
        found elements
      • find

        public <T extends Element> java.util.Collection<T> find​(java.util.Collection<? extends Element> roots,
                                                                @CheckForNull
                                                                java.lang.Class[] types,
                                                                boolean includeRoots,
                                                                boolean includeAdditionalContents,
                                                                @CheckForNull
                                                                org.eclipse.core.runtime.IProgressMonitor monitor)
        Collect all elements of given specific type (not super class or interface) from the root element.
        Parameters:
        roots - the root element for searching
        types - an array of Element's class types (Class.class, Package.class, Property.class and etc)
        includeRoots - include root elements into search results
        includeAdditionalContents - include additional content of Element defined in DSL
        monitor - progress monitor
        Returns:
        found elements
      • internalFind

        private static <T extends Element> java.util.Collection<T> internalFind​(java.util.Collection<? extends Element> roots,
                                                                                @CheckForNull
                                                                                java.lang.Class[] types,
                                                                                boolean includeRoots,
                                                                                boolean includeAdditionalContents,
                                                                                boolean useConcurrentFind,
                                                                                @CheckForNull
                                                                                org.eclipse.core.runtime.IProgressMonitor monitor)
      • concurrentFind

        @CheckForNull
        private static <T extends Element> java.util.Collection<T> concurrentFind​(com.nomagic.magicdraw.uml.FindFunction<T> finderFunction,
                                                                                  java.util.Collection<? extends Element> roots,
                                                                                  @CheckForNull
                                                                                  java.lang.Class[] types,
                                                                                  boolean includeRoots,
                                                                                  boolean includeAdditionalContents,
                                                                                  @CheckForNull
                                                                                  org.eclipse.core.runtime.IProgressMonitor monitor)
      • canStartConcurrentFind

        private static boolean canStartConcurrentFind()
      • createMonitor

        @Nonnull
        private static org.eclipse.core.runtime.IProgressMonitor createMonitor​(@CheckForNull
                                                                               org.eclipse.core.runtime.IProgressMonitor monitor)
      • isWholeNotEsiProject

        private static boolean isWholeNotEsiProject​(java.util.Collection<? extends Element> roots)
      • internalFindIgnoreName

        private static <T extends Element> java.util.Collection<T> internalFindIgnoreName​(java.util.Collection<? extends Element> roots,
                                                                                          @CheckForNull
                                                                                          java.lang.Class[] types,
                                                                                          boolean includeRoots,
                                                                                          boolean includeAdditionalContents,
                                                                                          @CheckForNull
                                                                                          org.eclipse.core.runtime.IProgressMonitor monitor)
      • internalIterator

        private static <T extends ElementCloseableIterator<T> internalIterator​(java.util.Collection<? extends Element> roots,
                                                                                 @CheckForNull
                                                                                 java.lang.Class[] types,
                                                                                 boolean includeRoot)