/** * Gets the system default ordering for annotation properties. * * @param delegate A delegate that is used for comparing properties that are not specified with the default ordering. * Not {@code null}. * @return The comparator. */ public static AnnotationPropertyComparator withDefaultOrdering(Comparator<? super OWLAnnotationProperty> delegate) { return new AnnotationPropertyComparator(DEFAULT_ORDERING, checkNotNull(delegate)); }
private int getAnnotationPropertyDifference(OWLAnnotationProperty property1, OWLAnnotationProperty property2) { OWLRendererPreferences preferences = OWLRendererPreferences.getInstance(); List<IRI> annotationIRIs = preferences.getAnnotationIRIs(); int index1 = annotationIRIs.indexOf(property1.getIRI()); int index2 = annotationIRIs.indexOf(property2.getIRI()); int diff = 0; if (index1 != -1 && index2 != -1) { diff = index1 - index2; } if (diff != 0) { return diff; } AnnotationPropertyComparator comparator = AnnotationPropertyComparator.withDefaultOrdering(owlObjectComparator); return comparator.compare(property1, property2); }
.forEach(cls -> renderEntities(typesPage, Collections.singleton(cls))); Comparator<OWLAnnotationProperty> propertyComparator = AnnotationPropertyComparator.withDefaultOrdering(c); Comparator<OWLObject> valueComparator = editorKit.getOWLModelManager().getOWLObjectComparator();
private int getAnnotationPropertyDifference(OWLAnnotationProperty property1, OWLAnnotationProperty property2) { OWLRendererPreferences preferences = OWLRendererPreferences.getInstance(); List<IRI> annotationIRIs = preferences.getAnnotationIRIs(); int index1 = annotationIRIs.indexOf(property1.getIRI()); int index2 = annotationIRIs.indexOf(property2.getIRI()); int diff = 0; if (index1 != -1 && index2 != -1) { diff = index1 - index2; } if (diff != 0) { return diff; } AnnotationPropertyComparator comparator = AnnotationPropertyComparator.withDefaultOrdering(owlObjectComparator); return comparator.compare(property1, property2); }
.forEach(cls -> renderEntities(typesPage, Collections.singleton(cls))); Comparator<OWLAnnotationProperty> propertyComparator = AnnotationPropertyComparator.withDefaultOrdering(c); Comparator<OWLObject> valueComparator = editorKit.getOWLModelManager().getOWLObjectComparator();
protected void refill(O root) { List<Object> data = new ArrayList<>(); data.add(header); if (root != null){ List<OWLAnnotation> annotations = new ArrayList<>(root.getAnnotations()); Comparator<OWLObject> owlObjectComparator = editorKit.getOWLModelManager().getOWLObjectComparator(); AnnotationPropertyComparator annotationPropertyComparator = AnnotationPropertyComparator.withDefaultOrdering(owlObjectComparator); annotations.sort((a1, a2) -> { int propComp = annotationPropertyComparator.compare(a1.getProperty(), a2.getProperty()); if(propComp != 0) { return propComp; } return owlObjectComparator.compare(a1.getValue(), a2.getValue()); }); for (OWLAnnotation annot : annotations){ data.add(new AnnotationsListItem(annot)); } } setListData(data.toArray()); revalidate(); }
/** * Gets the system default ordering for annotation properties. * * @param delegate A delegate that is used for comparing properties that are not specified with the default ordering. * Not {@code null}. * @return The comparator. */ public static AnnotationPropertyComparator withDefaultOrdering(Comparator<? super OWLAnnotationProperty> delegate) { return new AnnotationPropertyComparator(DEFAULT_ORDERING, checkNotNull(delegate)); }
protected void refill(O root) { List<Object> data = new ArrayList<>(); data.add(header); if (root != null){ List<OWLAnnotation> annotations = new ArrayList<>(root.getAnnotations()); Comparator<OWLObject> owlObjectComparator = editorKit.getOWLModelManager().getOWLObjectComparator(); AnnotationPropertyComparator annotationPropertyComparator = AnnotationPropertyComparator.withDefaultOrdering(owlObjectComparator); annotations.sort((a1, a2) -> { int propComp = annotationPropertyComparator.compare(a1.getProperty(), a2.getProperty()); if(propComp != 0) { return propComp; } return owlObjectComparator.compare(a1.getValue(), a2.getValue()); }); for (OWLAnnotation annot : annotations){ data.add(new AnnotationsListItem(annot)); } } setListData(data.toArray()); revalidate(); }