protected String printConstraints( @NonNull Map<EModelElement, Set<LeafConstrainingNode>> allConstraints) { StringBuilder s = new StringBuilder(); ArrayList<EModelElement> sortedList = new ArrayList<EModelElement>(allConstraints.keySet()); // Collections.sort(sortedList, new Comparator<EClassifier>() // { // public int compare(EClassifier o1, EClassifier o2) { // return o1.getName().compareTo(o2.getName()); // } // }); for (@SuppressWarnings("null") @NonNull EModelElement eObject : sortedList) { Set<LeafConstrainingNode> constraints = allConstraints.get(eObject); if ((constraints != null) && (constraints.size() > 0)) { LeafConstrainingNode firstConstraint = constraints.iterator().next(); ConstraintLocator constraintLocator = firstConstraint.getConstraintLocator(); s.append("\t"); s.append(constraintLocator.getLabel(eObject)); s.append(":"); for (ConstrainingNode constraint : constraints) { s.append(" \'" + constraint.getLabel() + "'"); } } s.append("\n"); } return s.toString(); }
/** * Create the ResultValidatableNode,ResultConstrainingNode cross-linkage between constrainedObject * and each child constraint of constrainingType. */ protected void createResultNodes( @NonNull EObject constrainedObject, @NonNull URI constrainingType) { ConstrainingNode constrainingNode = allConstrainingNodes.get(constrainingType); if (constrainingNode != null) { List<ConstrainingNode> children = constrainingNode.getChildren(); if (children.size() > 0) { ValidatableNode validatable = getValidatableNode(constrainedObject); for (@SuppressWarnings("null") @NonNull ConstrainingNode leafConstrainingNode : children) { ResultConstrainingNode resultConstrainingNode = createResultConstrainingNode(); ResultValidatableNode resultValidatableNode = createResultValidatableNode(); resultConstrainingNode.setResultValidatableNode(resultValidatableNode); resultConstrainingNode.setLabel(validatable.getLabel()); resultValidatableNode.setLabel(leafConstrainingNode.getLabel()); leafConstrainingNode.getChildren().add(resultConstrainingNode); validatable.getChildren().add(resultValidatableNode); } } } }
protected String printConstrainingNodes(@NonNull Set<EClass> eClasses) { StringBuilder s = new StringBuilder(); ArrayList<EClass> sortedList = new ArrayList<EClass>(eClasses); Collections.sort( sortedList, new Comparator<EClass>() { public int compare(EClass o1, EClass o2) { return o1.getName().compareTo(o2.getName()); } }); for (EClass eClass : sortedList) { s.append("\t" + eClass.getName() + ":"); ConstrainingNode classConstrainingNode = allConstrainingNodes.get(eClass); if (classConstrainingNode != null) { for (ConstrainingNode constraint : classConstrainingNode.getChildren()) { s.append(" \'" + constraint.getLabel() + "'"); } } s.append("\n"); } return s.toString(); }