Package com.nomagic.magicdraw.uml
Class Finder.ByTypeRecursivelyFinder
- java.lang.Object
-
- com.nomagic.magicdraw.uml.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)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
Finder.ByTypeRecursivelyFinder.CancelableProgressMonitor
-
Field Summary
Fields Modifier and Type Field Description private static int
MAX_CONCURRENT_FIND
private static boolean
SKIP_CONCURRENT_FIND
private static java.util.concurrent.ThreadPoolExecutor
threadPoolExecutor
-
Constructor Summary
Constructors Modifier Constructor Description private
ByTypeRecursivelyFinder()
-
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).
-
-
-
Method Detail
-
iterator
public <T extends Element> CloseableIterator<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 Element> CloseableIterator<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 elementincludeRoot
- include root into result- Returns:
- iterator
-
iterator
public <T extends Element> CloseableIterator<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 Element> CloseableIterator<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 elementincludeRoot
- include root elements into result- Returns:
- iterator
-
iterator
public <T extends Element> CloseableIterator<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
- projecttypes
- element type. Null means any element- Returns:
- iterator
-
iterator
public <T extends Element> CloseableIterator<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
- projecttypes
- element type. Null means any elementincludeRoot
- 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 searchingtypes
- 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 searchingtypes
- 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
- projecttypes
- 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
- projecttypes
- 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 searchingtypes
- an array of Element's class types (Class.class, Package.class, Property.class and etc)includeRoot
- include root elements into search resultsincludeAdditionalContents
- include additional content of Element defined in DSLmonitor
- 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 searchingtypes
- 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 searchingtypes
- an array of Element's class types (Class.class, Package.class, Property.class and etc)includeRoots
- include root elements into search resultsincludeAdditionalContents
- include additional content of Element defined in DSLmonitor
- 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 Element> CloseableIterator<T> internalIterator(java.util.Collection<? extends Element> roots, @CheckForNull java.lang.Class[] types, boolean includeRoot)
-
-