コード例 #1
0
 public int getPropertiesNotPresent(NType p) {
   int count = 0;
   for (Property pid : app.getProperties(p, true, true)) {
     if (!definedProperty(pid.getID())) {
       count++;
     }
   }
   return count;
 }
コード例 #2
0
  public void addProperty(String id) {
    Property p = app.getPropertyByID(id);
    PropertyValue propertyValue = p.newDefaultValue(detail.getMode());
    propertyValue.setProperty(id);

    detail.getValues().add(propertyValue);

    refreshPatternBar();
    refreshProperties();
  }
コード例 #3
0
  public boolean supportsAnotherProperty(String propertyID) {
    Property p = app.getPropertyByID(propertyID);
    if (p.getCardinalityMax() == -1) {
      return true;
    }

    int present = getPropertiesPresent(propertyID);
    if (present < p.getCardinalityMax()) {
      return true;
    }

    return false;
  }
コード例 #4
0
  public void addNewPattern(String patternID) {
    if (!detail.getTypes().contains(patternID)) {
      NType p = app.getType(patternID);
      if (p != null) {
        detail.addType(patternID);

        for (Property pr : app.getAvailableProperties(detail).keySet()) {
          if (pr.getCardinalityMin() > 0) {
            for (int i = getPropertiesPresent(pr.getID()); i < pr.getCardinalityMin(); i++) {
              addProperty(pr.getID());
            }
          }
        }
      }

      refreshPatternBar();
      refreshProperties();
    }
  }