コード例 #1
0
 private boolean isPartOfHierarchy(ContextualProperty c1, ContextualProperty c2) {
   if (c1.getContext() != null && c2.getContext() != null) {
     int rel = TypeUtil.getRelationship(fEnv, c1.getContext(), c2.getContext());
     return (rel | UMLReflection.RELATED_TYPE) != 0;
   }
   return false;
 }
コード例 #2
0
 @Override
 public String toString() {
   StringBuilder buf = new StringBuilder();
   buf.append('[');
   if (hierarchy != null) {
     for (ContextualProperty prop : hierarchy) {
       if (prop.getContext() != null) {
         buf.append(prop.getContext().getName());
       }
       buf.append(',');
     }
   }
   buf.append(']');
   return buf.toString();
 }
コード例 #3
0
  private void readHierarchy(Module module) {
    for (ModuleImport moduleImport : module.getModuleImport()) {
      Module importedModule = moduleImport.getImportedModule();
      if (importedModule != null) {
        readHierarchy(importedModule);
      }
    }

    for (EStructuralFeature nextFeature : module.getEAllStructuralFeatures()) {
      if (nextFeature instanceof ContextualProperty) {
        ContextualProperty ctxProp = (ContextualProperty) nextFeature;
        if (ctxProp.getContext() == null) {
          continue;
        }
        String name = ctxProp.getName();
        List<Entry> entryList = getData().get(name);
        if (entryList == null) {
          entryList = new LinkedList<Entry>();
          getData().put(name, entryList);
        }

        boolean joined = false;
        for (Entry entry : entryList) {
          if (entry.addIfApplicable(ctxProp)) {
            joined = true;
            break;
          }
        }

        if (!joined) {
          Entry newEntry = new Entry();
          entryList.add(newEntry);
          newEntry.addIfApplicable(ctxProp);
        }
      }
    }
  }
コード例 #4
0
  public boolean hasHierarchyClashes(ContextualProperty property) {
    if (fData == null || fData.isEmpty()) {
      return false;
    }

    List<Entry> entryList = fData.get(property.getName());
    if (entryList == null) {
      return false;
    }

    for (Entry entry : entryList) {
      Boolean status = entry.isClashingWith(property);
      if (Boolean.TRUE.equals(status)) {
        return true;
      }
    }
    return false;
  }