public int getPropertiesNotPresent(NType p) { int count = 0; for (Property pid : app.getProperties(p, true, true)) { if (!definedProperty(pid.getID())) { count++; } } return count; }
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(); }
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; }
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(); } }