/** * @param type type of the returned array * @param c array to sort * @return sorted list containing all elements in the collection, minus nulls and duplicates. * The list is immutable. */ @SafeVarargs public static <T> List<T> sorted(Class<T> type, T... c) { return sorted(type, Arrays.asList(c)); }
/** * @param classExpressions classes * @param annotations annotations */ public OWLNaryClassAxiomImpl(Collection<? extends OWLClassExpression> classExpressions, Collection<OWLAnnotation> annotations) { super(annotations); checkNotNull(classExpressions, "classExpressions cannot be null"); this.classExpressions = sorted(OWLClassExpression.class, classExpressions); }
/** * A convenience method for implementation that returns a set containing the annotations on this * axiom plus the annotations in the specified set. * * @param annos The annotations to add to the annotations on this axiom * @return The annotations */ protected Collection<OWLAnnotation> mergeAnnos(Stream<OWLAnnotation> annos) { return sorted(OWLAnnotation.class, Stream.concat(annos, annotations())); }
/** * @param values values for oneof */ public OWLObjectOneOfImpl(Stream<OWLIndividual> values) { checkNotNull(values, "values cannot be null"); this.values = sorted(OWLIndividual.class, values); }
/** * @param properties properties * @param annotations annotations */ @SuppressWarnings("unchecked") public OWLNaryPropertyAxiomImpl(Collection<? extends P> properties, Collection<OWLAnnotation> annotations) { super(annotations); checkNotNull(properties, "properties cannot be null"); this.properties = (List<P>) sorted(OWLPropertyExpression.class, properties); }
/** * @param properties properties * @param annotations annotations */ @SuppressWarnings("unchecked") public OWLNaryPropertyAxiomImpl(Stream<? extends P> properties, Collection<OWLAnnotation> annotations) { super(annotations); checkNotNull(properties, "properties cannot be null"); this.properties = (List<P>) sorted(OWLPropertyExpression.class, properties); }
/** * @param individuals individuals * @param annotations annotations on the axiom */ public OWLNaryIndividualAxiomImpl(Collection<? extends OWLIndividual> individuals, Collection<OWLAnnotation> annotations) { super(annotations); checkNotNull(individuals, "individuals cannot be null"); this.individuals = sorted(OWLIndividual.class, individuals); }
/** * @param operands operands */ public OWLNaryBooleanClassExpressionImpl(Collection<? extends OWLClassExpression> operands) { checkNotNull(operands, "operands cannot be null"); this.operands = sorted(OWLClassExpression.class, operands); }
/** * @param individuals individuals * @param annotations annotations on the axiom */ public OWLNaryIndividualAxiomImpl(Collection<? extends OWLIndividual> individuals, Collection<OWLAnnotation> annotations) { super(annotations); checkNotNull(individuals, "individuals cannot be null"); this.individuals = sorted(OWLIndividual.class, individuals); }
/** * @param values values for oneof */ public OWLObjectOneOfImpl(Stream<OWLIndividual> values) { checkNotNull(values, "values cannot be null"); this.values = sorted(OWLIndividual.class, values); }
/** * @param datatype datatype * @param facetRestrictions facet restriction */ public OWLDatatypeRestrictionImpl(OWLDatatype datatype, Collection<OWLFacetRestriction> facetRestrictions) { this.datatype = checkNotNull(datatype, "datatype cannot be null"); checkNotNull(facetRestrictions, "facetRestrictions cannot be null"); this.facetRestrictions = sorted(OWLFacetRestriction.class, facetRestrictions); }
/** * @param first first property * @param second second peoperty * @param annotations annotations */ public OWLInverseObjectPropertiesAxiomImpl(OWLObjectPropertyExpression first, OWLObjectPropertyExpression second, Collection<OWLAnnotation> annotations) { super(sorted(OWLObjectPropertyExpression.class, checkNotNull(first, "first cannot be null"), checkNotNull(second, "second cannot be null")), annotations); this.first = first; this.second = second; }
@Override public Collection<OWLEquivalentObjectPropertiesAxiom> asPairwiseAxioms() { if (properties.size() == 2) { return CollectionFactory.createSet(this); } return walkPairwise((a, b) -> new OWLEquivalentObjectPropertiesAxiomImpl( sorted(OWLObjectPropertyExpression.class, a, b), NO_ANNOTATIONS)); }
@Override public Collection<OWLEquivalentObjectPropertiesAxiom> splitToAnnotatedPairs() { if (properties.size() == 2) { return CollectionFactory.createSet(this); } return walkPairwise((a, b) -> new OWLEquivalentObjectPropertiesAxiomImpl( sorted(OWLObjectPropertyExpression.class, a, b), annotations)); }
@Override public Collection<OWLDisjointDataPropertiesAxiom> splitToAnnotatedPairs() { if (properties.size() == 2) { return CollectionFactory.createSet(this); } return walkPairwise((a, b) -> new OWLDisjointDataPropertiesAxiomImpl( sorted(OWLDataPropertyExpression.class, a, b), annotations)); } }
@Override public Collection<OWLEquivalentDataPropertiesAxiom> asPairwiseAxioms() { if (properties.size() == 2) { return CollectionFactory.createSet(this); } return walkPairwise((a, b) -> new OWLEquivalentDataPropertiesAxiomImpl( sorted(OWLDataPropertyExpression.class, a, b), NO_ANNOTATIONS)); }
@Override public Collection<OWLEquivalentDataPropertiesAxiom> splitToAnnotatedPairs() { if (properties.size() == 2) { return CollectionFactory.createSet(this); } return walkPairwise((a, b) -> new OWLEquivalentDataPropertiesAxiomImpl( sorted(OWLDataPropertyExpression.class, a, b), annotations)); }
@Override public Collection<OWLSameIndividualAxiom> splitToAnnotatedPairs() { if (individuals.size() == 2) { return CollectionFactory.createSet(this); } return walkPairwise((a, b) -> new OWLSameIndividualAxiomImpl(sorted(OWLIndividual.class, a, b), annotations)); }
@Override public Collection<OWLDisjointDataPropertiesAxiom> asPairwiseAxioms() { if (properties.size() == 2) { return CollectionFactory.createSet(this); } return walkPairwise((a, b) -> new OWLDisjointDataPropertiesAxiomImpl( sorted(OWLDataPropertyExpression.class, a, b), NO_ANNOTATIONS)); }
@Override public Collection<OWLDisjointObjectPropertiesAxiom> asPairwiseAxioms() { if (properties.size() == 2) { return CollectionFactory.createSet(this); } return walkPairwise((a, b) -> new OWLDisjointObjectPropertiesAxiomImpl( sorted(OWLObjectPropertyExpression.class, a, b), NO_ANNOTATIONS)); }