Loading de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/common/TTCN3ReferenceHelper.java +47 −1 Original line number Diff line number Diff line Loading @@ -76,4 +76,50 @@ public class TTCN3ReferenceHelper { return false; } @SuppressWarnings("unchecked") public static boolean isReferenced2(EObject rootElement, Set<? extends EObject> targets) { boolean found = false; for(EReference ref: rootElement.eClass().getEAllReferences()) { if (found) return true; if(rootElement.eIsSet(ref)) { if(ref.isContainment()) { Object content = rootElement.eGet(ref, false); if(ref.isMany()) { InternalEList<EObject> contentList = (InternalEList<EObject>) content; for(int i=0; i<contentList.size(); ++i) { EObject childElement = contentList.basicGet(i); if(!childElement.eIsProxy()) found |= isReferenced2(childElement, targets); } } else { EObject childElement = (EObject) content; if(!childElement.eIsProxy()) found |= isReferenced2(childElement, targets); } } else if (!ref.isContainer()) { Object value = rootElement.eGet(ref, false); if(ref.isMany()) { InternalEList<EObject> values = (InternalEList<EObject>) value; for(int i=0; i< values.size(); ++i) { EObject refElement = values.get(i); if(targets.contains(refElement)) { return true; } } } else { EObject refElement = (EObject) value; if(targets.contains(refElement)) { return true; } } } } } return found; } } de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/validation/CodeStyleValidator.xtend +2 −3 Original line number Diff line number Diff line Loading @@ -610,8 +610,7 @@ class CodeStyleValidator extends AbstractDeclarativeValidator { stopwatch.start val target = newHashSet(type); var boolean found = parent.isReferenced(target) var boolean found = parent.isReferenced2(target) stopwatch.stop Loading @@ -622,7 +621,7 @@ class CodeStyleValidator extends AbstractDeclarativeValidator { // only consider modules that are importing the current module if (statistics.isBaseModuleImported(parent, currentBase.name)) { if (currentBase.isReferenced(target)) { if (currentBase.isReferenced2(target)) { return false } } Loading Loading
de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/common/TTCN3ReferenceHelper.java +47 −1 Original line number Diff line number Diff line Loading @@ -76,4 +76,50 @@ public class TTCN3ReferenceHelper { return false; } @SuppressWarnings("unchecked") public static boolean isReferenced2(EObject rootElement, Set<? extends EObject> targets) { boolean found = false; for(EReference ref: rootElement.eClass().getEAllReferences()) { if (found) return true; if(rootElement.eIsSet(ref)) { if(ref.isContainment()) { Object content = rootElement.eGet(ref, false); if(ref.isMany()) { InternalEList<EObject> contentList = (InternalEList<EObject>) content; for(int i=0; i<contentList.size(); ++i) { EObject childElement = contentList.basicGet(i); if(!childElement.eIsProxy()) found |= isReferenced2(childElement, targets); } } else { EObject childElement = (EObject) content; if(!childElement.eIsProxy()) found |= isReferenced2(childElement, targets); } } else if (!ref.isContainer()) { Object value = rootElement.eGet(ref, false); if(ref.isMany()) { InternalEList<EObject> values = (InternalEList<EObject>) value; for(int i=0; i< values.size(); ++i) { EObject refElement = values.get(i); if(targets.contains(refElement)) { return true; } } } else { EObject refElement = (EObject) value; if(targets.contains(refElement)) { return true; } } } } } return found; } }
de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/validation/CodeStyleValidator.xtend +2 −3 Original line number Diff line number Diff line Loading @@ -610,8 +610,7 @@ class CodeStyleValidator extends AbstractDeclarativeValidator { stopwatch.start val target = newHashSet(type); var boolean found = parent.isReferenced(target) var boolean found = parent.isReferenced2(target) stopwatch.stop Loading @@ -622,7 +621,7 @@ class CodeStyleValidator extends AbstractDeclarativeValidator { // only consider modules that are importing the current module if (statistics.isBaseModuleImported(parent, currentBase.name)) { if (currentBase.isReferenced(target)) { if (currentBase.isReferenced2(target)) { return false } } Loading