Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kernel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
af3
kernel
Commits
94034458
Commit
94034458
authored
13 years ago
by
Daniel Ratiu
Browse files
Options
Downloads
Patches
Plain Diff
A first baseline of model-checking of simple code specifications.
refs 411
parent
e1669056
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/utils/EcoreUtils.java
+27
-0
27 additions, 0 deletions
...runk/src/org/fortiss/tooling/kernel/utils/EcoreUtils.java
with
27 additions
and
0 deletions
org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/utils/EcoreUtils.java
+
27
−
0
View file @
94034458
...
...
@@ -23,6 +23,9 @@ import java.util.List;
import
org.eclipse.emf.common.util.BasicEList
;
import
org.eclipse.emf.common.util.ECollections
;
import
org.eclipse.emf.common.util.EList
;
import
org.eclipse.emf.common.util.TreeIterator
;
import
org.eclipse.emf.ecore.EObject
;
import
org.eclipse.emf.ecore.util.EcoreUtil
;
/**
* Utility methods for dealing with .ecore models. These methods should be used
...
...
@@ -127,4 +130,28 @@ public class EcoreUtils {
return
(
T
)
sourceElement
;
return
null
;
}
/**
* For a given EObject recursively returns all its children that have a
* certain type.
*
* @param parent
* - the parent EObject
* @param type
* - the type
* @return a list of children
*/
@SuppressWarnings
(
"unchecked"
)
public
static
<
S
>
EList
<
S
>
getChildrenWithType
(
EObject
parent
,
Class
<
S
>
type
)
{
EList
<
S
>
children
=
new
BasicEList
<
S
>();
TreeIterator
<
EObject
>
content
=
EcoreUtil
.
getAllContents
(
parent
,
true
);
while
(
content
.
hasNext
())
{
EObject
child
=
content
.
next
();
if
(
type
.
isAssignableFrom
(
child
.
getClass
()))
{
children
.
add
((
S
)
child
);
}
}
return
children
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment