All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.semanticweb.owlapi.search.SupSubVisitor Maven / Gradle / Ivy

There is a newer version: 5.5.1
Show newest version
package org.semanticweb.owlapi.search;

import javax.annotation.Nonnull;

import org.semanticweb.owlapi.model.OWLObject;
import org.semanticweb.owlapi.model.OWLSubAnnotationPropertyOfAxiom;
import org.semanticweb.owlapi.model.OWLSubClassOfAxiom;
import org.semanticweb.owlapi.model.OWLSubDataPropertyOfAxiom;
import org.semanticweb.owlapi.model.OWLSubObjectPropertyOfAxiom;
import org.semanticweb.owlapi.util.OWLAxiomVisitorExAdapter;

@SuppressWarnings("unchecked")
class SupSubVisitor extends OWLAxiomVisitorExAdapter {

    private final boolean sup;

    @SuppressWarnings("null")
    SupSubVisitor(boolean sup) {
        super(null);
        this.sup = sup;
    }

    @Nonnull
    @Override
    public C visit(@Nonnull OWLSubAnnotationPropertyOfAxiom axiom) {
        return (C) (sup ? axiom.getSuperProperty() : axiom.getSubProperty());
    }

    @Nonnull
    @Override
    public C visit(@Nonnull OWLSubClassOfAxiom axiom) {
        return (C) (sup ? axiom.getSuperClass() : axiom.getSubClass());
    }

    @Nonnull
    @Override
    public C visit(@Nonnull OWLSubDataPropertyOfAxiom axiom) {
        return (C) (sup ? axiom.getSuperProperty() : axiom.getSubProperty());
    }

    @Nonnull
    @Override
    public C visit(@Nonnull OWLSubObjectPropertyOfAxiom axiom) {
        return (C) (sup ? axiom.getSuperProperty() : axiom.getSubProperty());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy