public final class ConstrainingURI extends java.lang.Object implements java.lang.Comparable<ConstrainingURI>
Duplicate nodes such as multiple same-named contexts in CompleteOCL may be merged.
Modifier and Type | Field and Description |
---|---|
protected org.eclipse.emf.common.util.URI |
uri
It is possible to have multiple "identical" contexts defined in an OCL file :
|
Constructor and Description |
---|
ConstrainingURI(org.eclipse.emf.common.util.URI uri) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(ConstrainingURI o) |
boolean |
equals(java.lang.Object obj) |
int |
hashCode() |
java.lang.String |
toString() |
@NonNull protected final org.eclipse.emf.common.util.URI uri
context EClass inv invariant1 : not name.oclIsUndefined() context EClass inv invariant2 : if interface then name.startsWith('I') else true endif;In such a case, the URI of the first will be
http://www.eclipse.org/emf/2002/Ecore#//EClass
while the URI of the second will be http://www.eclipse.org/emf/2002/Ecore#//EClass.1
. We wish to "regroup" both invariants
under the same context in the validity results.
private @NonNull static URI trimDuplicateContextSuffix(@NonNull URI uri) {
String fragment = uri.fragment();
// This should always be called on types, so we should be able to safely remove the trailing ".1" from the fragment
if (fragment.matches(".\*\.[0-9]+$")){
String trimmedFragment = fragment.replaceFirst("\\.[0-9]+$", "");
URI trimmedURI = uri.trimFragment().appendFragment(trimmedFragment);
assert trimmedURI != null;
return trimmedURI;
}
return uri;
}public ConstrainingURI(@NonNull org.eclipse.emf.common.util.URI uri)
public int compareTo(ConstrainingURI o)
compareTo
in interface java.lang.Comparable<ConstrainingURI>
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object