boolean bResult = false;
PrologDataIndexPair valIndLeft = env.unification.valueFromUnifStack(Type1, level1);
PrologDataIndexPair valIndRight = env.unification.valueFromUnifStack(Type2, level2);
if ((valIndLeft.pData == null) || (valIndRight.pData == null)) {
throw new ExecException(
"Error: for CG operations, types shoud have specific values.");
} else {
// The two PrologData are particular types (not free variables)
Object pData1Left;
Object pData1Right;
pData1Left = valIndLeft.pData.data;
pData1Right = valIndRight.pData.data;
String sData1 = (String) pData1Left;
String sData2 = (String) pData1Right;
if (env.typeHierarchy == null) {
throw new ExecException(
"Error : No type hierarchy is specified (a CG operation needs it).");
}
switch (OperCG) {
case e_maximalJoin: {
if (sData1.equals(sData2)) {
Type3 = sData1;
} else {
Type3 = env.typeHierarchy.maxComSubType(sData1,
sData2);
}
bResult = (!Type3.equals("Absurd"));
}
break;
case e_subsume: {
bResult = env.typeHierarchy.isSubType(sData2, sData1);
Type3 = sData2;
}
break;
case e_subsumeWithoutResult:
case e_partialContract:
case e_completeContract:
bResult = env.typeHierarchy.isSubType(sData2, sData1);
break;
case e_generalize: {
if (sData1.equals(sData2)) {
Type3 = sData1;
} else {
Type3 = env.typeHierarchy.minComSuperType(sData1,
sData2);
}
bResult = (!Type3.equals("Universal") &&
!Type3.equals("UNIVERSAL"));
}
break;
default:
throw new ExecException("Error : CG Operation not predefined.");
}
if (bResult && (Type3 != null)) {
C3.m_pdType = new PrologData(uIdentifier, Type3);
}