// Path: snorocket-core/src/main/java/au/csiro/snorocket/core/IFactory.java
// public interface IFactory extends Serializable {
//     
//     /**
//      * Internal id used for the top concept.
//      */
//     public static final int TOP_CONCEPT = 0;
//     
//     /**
//      * Internal id used for the bottom concept.
//      */
//     public static final int BOTTOM_CONCEPT = 1;
//     
//     /**
//      * Indicates if a concept, either named or virtual, exists.
//      * 
//      * @param key
//      * @return
//      */
//     boolean conceptExists(final Object key);
// 
//     /**
//      * Indicates if a role, either named or virtual, exists.
//      * 
//      * @param key
//      * @return
//      */
//     boolean roleExists(final Object key);
//     
//     /**
//      * Indicates if a feature exists.
//      * 
//      * @param key
//      * @return
//      */
//     boolean featureExists(final String key);
//     
//     /**
//      * Returns the internal id of a concept.
//      * 
//      * @param key
//      * @return
//      */
//     int getConcept(final Object key);
//     
//     /**
//      * Returns the internal id of a role.
//      * 
//      * @param key
//      * @return
//      */
//     int getRole(final Object key);
// 
//     /**
//      * Returns the internal id of a feature.
//      * 
//      * @param key
//      * @return
//      */
//     int getFeature(final String key);
//     
//     /**
//      * Returns the total number of concepts.
//      * 
//      * @return
//      */
//     int getTotalConcepts();
//     
//     /**
//      * Returns the total number of roles.
//      * 
//      * @return
//      */
//     int getTotalRoles();
//     
//     /**
//      * Returns the total number of features.
//      * 
//      * @return
//      */
//     int getTotalFeatures();
//     
//     /**
//      * Returns the external id of a concept given its internal id.
//      * 
//      * @param id
//      * @return
//      */
//     Object lookupConceptId(final int id);
//     
//     /**
//      * Returns the external id of a role given its internal id.
//      * 
//      * @param id
//      * @return
//      */
//     Object lookupRoleId(final int id);
//     
//     /**
//      * Returns a feature given its id.
//      * 
//      * @param id
//      * @return
//      */
//     String lookupFeatureId(final int id);
//     
//     /**
//      * Indicates if a concept, identified by its internal id, is virtual or
//      * named.
//      * 
//      * @param id
//      * @return
//      */
//     boolean isVirtualConcept(int id);
//     
//     /**
//      * Indicates if a role, identified by its internal id, is virtual or named.
//      * 
//      * @param id
//      * @return
//      */
//     boolean isVirtualRole(int id);
//     
//     /**
//      * Flags a concept as virtual.
//      * 
//      * @param id
//      * @param isVirtual
//      */
//     public void setVirtualConcept(int id, boolean isVirtual);
// 
// }


import au.csiro.snorocket.core.IFactory;

/**
 * Copyright (c) 2009 International Health Terminology Standards Development
 * Organisation
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * Copyright CSIRO Australian e-Health Research Centre (http://aehrc.com).
 * All rights reserved. Use is subject to license terms and conditions.
 */

package au.csiro.snorocket.core.axioms;


/**
 * Normal form 3: &#8707;r.A &#8851; B <br>
 * role r with value A subsumes B
 * 
 * @author law223
 * 
 */
public final class NF3 extends NormalFormGCI implements IConjunctionQueueEntry {

    /**
     * Serialisation version.
     */
    private static final long serialVersionUID = 1L;
    
    final public int lhsR;
    final public int lhsA;
    final public int rhsB;

    /**
     * r.A [ B
     * 
     * @param ontology
     * @param a
     * @param r
     * @param b
     */
    private NF3(int r, int a, int b) {
        lhsR = r;
        lhsA = a;
        rhsB = b;
    }

    public IConjunctionQueueEntry getQueueEntry() {
        return this;
    }

    public String toString() {
        return lhsR + "." + lhsA + " [ " + rhsB;
    }

    public static NF3 getInstance(int r, int A, int B) {
        return new NF3(r, A, B);
    }

    @Override
    public int[] getConceptsInAxiom() {
        return new int[] { lhsA, rhsB };
    }

    public int getB() {
        return rhsB;
    }

    public int getBi() {

// Path: snorocket-core/src/main/java/au/csiro/snorocket/core/IFactory.java
// public interface IFactory extends Serializable {
//     
//     /**
//      * Internal id used for the top concept.
//      */
//     public static final int TOP_CONCEPT = 0;
//     
//     /**
//      * Internal id used for the bottom concept.
//      */
//     public static final int BOTTOM_CONCEPT = 1;
//     
//     /**
//      * Indicates if a concept, either named or virtual, exists.
//      * 
//      * @param key
//      * @return
//      */
//     boolean conceptExists(final Object key);
// 
//     /**
//      * Indicates if a role, either named or virtual, exists.
//      * 
//      * @param key
//      * @return
//      */
//     boolean roleExists(final Object key);
//     
//     /**
//      * Indicates if a feature exists.
//      * 
//      * @param key
//      * @return
//      */
//     boolean featureExists(final String key);
//     
//     /**
//      * Returns the internal id of a concept.
//      * 
//      * @param key
//      * @return
//      */
//     int getConcept(final Object key);
//     
//     /**
//      * Returns the internal id of a role.
//      * 
//      * @param key
//      * @return
//      */
//     int getRole(final Object key);
// 
//     /**
//      * Returns the internal id of a feature.
//      * 
//      * @param key
//      * @return
//      */
//     int getFeature(final String key);
//     
//     /**
//      * Returns the total number of concepts.
//      * 
//      * @return
//      */
//     int getTotalConcepts();
//     
//     /**
//      * Returns the total number of roles.
//      * 
//      * @return
//      */
//     int getTotalRoles();
//     
//     /**
//      * Returns the total number of features.
//      * 
//      * @return
//      */
//     int getTotalFeatures();
//     
//     /**
//      * Returns the external id of a concept given its internal id.
//      * 
//      * @param id
//      * @return
//      */
//     Object lookupConceptId(final int id);
//     
//     /**
//      * Returns the external id of a role given its internal id.
//      * 
//      * @param id
//      * @return
//      */
//     Object lookupRoleId(final int id);
//     
//     /**
//      * Returns a feature given its id.
//      * 
//      * @param id
//      * @return
//      */
//     String lookupFeatureId(final int id);
//     
//     /**
//      * Indicates if a concept, identified by its internal id, is virtual or
//      * named.
//      * 
//      * @param id
//      * @return
//      */
//     boolean isVirtualConcept(int id);
//     
//     /**
//      * Indicates if a role, identified by its internal id, is virtual or named.
//      * 
//      * @param id
//      * @return
//      */
//     boolean isVirtualRole(int id);
//     
//     /**
//      * Flags a concept as virtual.
//      * 
//      * @param id
//      * @param isVirtual
//      */
//     public void setVirtualConcept(int id, boolean isVirtual);
// 
// }


// Path: snorocket-core/src/main/java/au/csiro/snorocket/core/axioms/NF3.java
import au.csiro.snorocket.core.IFactory;

/**
 * Copyright (c) 2009 International Health Terminology Standards Development
 * Organisation
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * Copyright CSIRO Australian e-Health Research Centre (http://aehrc.com).
 * All rights reserved. Use is subject to license terms and conditions.
 */

package au.csiro.snorocket.core.axioms;


/**
 * Normal form 3: &#8707;r.A &#8851; B <br>
 * role r with value A subsumes B
 * 
 * @author law223
 * 
 */
public final class NF3 extends NormalFormGCI implements IConjunctionQueueEntry {

    /**
     * Serialisation version.
     */
    private static final long serialVersionUID = 1L;
    
    final public int lhsR;
    final public int lhsA;
    final public int rhsB;

    /**
     * r.A [ B
     * 
     * @param ontology
     * @param a
     * @param r
     * @param b
     */
    private NF3(int r, int a, int b) {
        lhsR = r;
        lhsA = a;
        rhsB = b;
    }

    public IConjunctionQueueEntry getQueueEntry() {
        return this;
    }

    public String toString() {
        return lhsR + "." + lhsA + " [ " + rhsB;
    }

    public static NF3 getInstance(int r, int A, int B) {
        return new NF3(r, A, B);
    }

    @Override
    public int[] getConceptsInAxiom() {
        return new int[] { lhsA, rhsB };
    }

    public int getB() {
        return rhsB;
    }

    public int getBi() {

        return IFactory.TOP_CONCEPT;
