Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Camille
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
Camille
Commits
60758b18
Commit
60758b18
authored
1 year ago
by
dgelessus
Browse files
Options
Downloads
Patches
Plain Diff
Optimize EventBEObjectMatcher slightly
parent
add3ed8e
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
org.eventb.texttools/src/org/eventb/texttools/diffmerge/EventBEObjectMatcher.java
+9
-22
9 additions, 22 deletions
.../org/eventb/texttools/diffmerge/EventBEObjectMatcher.java
with
9 additions
and
22 deletions
org.eventb.texttools/src/org/eventb/texttools/diffmerge/EventBEObjectMatcher.java
+
9
−
22
View file @
60758b18
...
...
@@ -78,14 +78,16 @@ public class EventBEObjectMatcher implements IEObjectMatcher {
/*
* Only one variant may exist in a model, so two variants are a match
*/
if
(
areVariants
(
left
,
candidate
))
{
if
(
left
instanceof
Variant
)
{
assert
candidate
instanceof
Variant
;
return
true
;
}
/*
* Improve matching for event b named objects with same name
*/
if
(
left
instanceof
EventBNamed
&&
candidate
instanceof
EventBNamed
)
{
if
(
left
instanceof
EventBNamed
)
{
assert
candidate
instanceof
EventBNamed
;
EventBNamed
l
=
(
EventBNamed
)
left
;
EventBNamed
c
=
(
EventBNamed
)
candidate
;
...
...
@@ -98,36 +100,21 @@ public class EventBEObjectMatcher implements IEObjectMatcher {
* rely on emf identifiers after the event-b specific code
*/
String
idLeft
=
getEMFId
(
left
);
String
idCandidate
=
getEMFId
(
candidate
);
if
(
idLeft
!=
null
&&
idLeft
.
equals
(
idCandidate
))
{
return
true
;
}
if
(
idLeft
==
null
)
{
return
false
;
}
String
idCandidate
=
getEMFId
(
candidate
);
return
idLeft
.
equals
(
idCandidate
);
}
private
static
boolean
areSameType
(
final
EObject
obj1
,
final
EObject
obj2
)
{
return
obj1
!=
null
&&
obj2
!=
null
&&
obj1
.
eClass
().
equals
(
obj2
.
eClass
());
}
/**
* Test if both given {@link EObject}s are of type {@link Variant}, includes
* <code>null</code> check.
*
* @param obj1
* @param obj2
* @return
*/
private
static
boolean
areVariants
(
final
EObject
obj1
,
final
EObject
obj2
)
{
return
areSameType
(
obj1
,
obj2
)
&&
obj2
instanceof
Variant
;
}
private
static
String
getEMFId
(
EObject
eObject
)
{
final
String
identifier
;
if
(
eObject
==
null
)
{
identifier
=
null
;
}
else
if
(
eObject
.
eIsProxy
())
{
if
(
eObject
.
eIsProxy
())
{
identifier
=
((
InternalEObject
)
eObject
).
eProxyURI
().
fragment
();
}
else
{
String
functionalId
=
EcoreUtil
.
getID
(
eObject
);
...
...
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