if (lhs instanceof Concept) {
if (rhs instanceof Concept) {
final int newLhs = lhs.hashCode();
result = NF1a.getInstance(newLhs, rhs.hashCode());
} else if (rhs instanceof Existential) {
final Existential existential = (Existential) rhs;
result = NF2.getInstance(lhs.hashCode(), existential.getRole(),
existential.getConcept().hashCode());
} else if (rhs instanceof Datatype) {
final Datatype datatype = (Datatype) rhs;
result = NF7.getInstance(lhs.hashCode(), datatype);
} else {
throw new IllegalStateException("GCI is not in Normal Form: " +
"lhs is Concept but rhs is neither Concept, " +
"Existential nor Datatype; it is " + rhs);
}
} else if (lhs instanceof Conjunction) {
final Conjunction conjunction = (Conjunction) lhs;
final AbstractConcept[] concepts = conjunction.getConcepts();
if (concepts.length == 1) {
result = NF1a.getInstance(concepts[0].hashCode(),
rhs.hashCode());
} else if (concepts.length == 2) {
result = NF1b.getInstance(concepts[0].hashCode(),
concepts[1].hashCode(), rhs.hashCode());
} else {
throw new IllegalStateException(
"Conjunction should have exactly one or two "
+ "Concepts not " + concepts.length + ": "
+ conjunction);
}
} else if (lhs instanceof Existential) {
Existential existential = (Existential) lhs;
result = NF3.getInstance(existential.getRole(), existential
.getConcept().hashCode(), rhs.hashCode());
} else if (lhs instanceof Datatype) {
Datatype datatype = (Datatype) lhs;
result = NF8.getInstance(datatype, rhs.hashCode());
} else {