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
f1f7aea5
Commit
f1f7aea5
authored
13 years ago
by
David Trachtenherz
Browse files
Options
Downloads
Patches
Plain Diff
Some static utility methods moved to new class ModelElementUtils
refs 337
parent
f1c01aeb
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.base/trunk/src/org/fortiss/tooling/base/utils/ModelElementUtils.java
+77
-0
77 additions, 0 deletions
...src/org/fortiss/tooling/base/utils/ModelElementUtils.java
with
77 additions
and
0 deletions
org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/utils/ModelElementUtils.java
0 → 100644
+
77
−
0
View file @
f1f7aea5
/*--------------------------------------------------------------------------+
$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $
| |
| Copyright 2011 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package
org.fortiss.tooling.base.utils
;
import
java.util.Collection
;
import
java.util.LinkedList
;
import
java.util.List
;
import
org.fortiss.tooling.base.model.element.IHiddenSpecification
;
import
org.fortiss.tooling.base.model.element.IModelElement
;
import
org.fortiss.tooling.base.model.element.IModelElementSpecification
;
/**
* Utility class for model elements.
*
* @see IModelElement
* @see IModelElementSpecification
*
* @author trachtenherz
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating RED Hash:
*/
public
class
ModelElementUtils
{
/**
* Returns a list of specifications from {@code specifications} that are not
* subclass of {@link IHiddenSpecification}.
*/
public
static
List
<
IModelElementSpecification
>
nonHiddenSpecifications
(
Collection
<
IModelElementSpecification
>
specifications
)
{
List
<
IModelElementSpecification
>
res
=
new
LinkedList
<
IModelElementSpecification
>();
for
(
IModelElementSpecification
s
:
specifications
)
{
if
(!(
s
instanceof
IHiddenSpecification
))
{
res
.
add
(
s
);
}
}
return
res
;
}
/**
* Returns the {@link IModelElementSpecification#specificationDescription()}
* result for {@code spec}.
* <p>
* If the specification is hidden (instance of {@link IHiddenSpecification})
* or does not support this operation (
* {@link IModelElementSpecification#specificationDescription()} throws
* {@link UnsupportedOperationException}) then empty string is returned.
*
*/
public
static
String
specificationDescription
(
IModelElementSpecification
spec
)
{
if
(
spec
instanceof
IHiddenSpecification
)
{
// Empty representation for hidden specifications
return
""
;
}
try
{
return
spec
.
specificationDescription
();
}
catch
(
UnsupportedOperationException
e
)
{
return
""
;
}
}
}
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