} else {
autoBurnLastResult = AutoburnLogic.AutoburnAction.IMPOSSIBLE;
}
} else {
AutoburnInfo autoburnInfo =
GemGraph.isAncestorOfBrokenGemForest(thisGem) ?
null :
AutoburnLogic.getAutoburnInfo(typeToUnify, thisGem, tableTop.getTypeCheckInfo());
AutoburnUnifyStatus autoburnUnifyStatus =
autoburnInfo != null ?
autoburnInfo.getAutoburnUnifyStatus() :
AutoburnLogic.AutoburnUnifyStatus.NOT_POSSIBLE;
if (autoburnUnifyStatus == AutoburnUnifyStatus.UNAMBIGUOUS_NOT_NECESSARY) {
// This means the gems can be connected either by burning them or by
// just connecting them without burning. In this case we want to determine
// which action is best and do that.
int noBurnCloseness = TypeExpr.getTypeCloseness(thisGem.getOutputPart().getType(), typeToUnify, currentModuleTypeInfo);
if (autoburnInfo.getMaxTypeCloseness() > noBurnCloseness) {
autoburnUnifyStatus = AutoburnUnifyStatus.UNAMBIGUOUS;
} else {
autoburnUnifyStatus = AutoburnUnifyStatus.NOT_NECESSARY;
}
// Now resume checking the basic possibilities.
}
if (autoburnUnifyStatus == AutoburnUnifyStatus.UNAMBIGUOUS) {
autoBurnLastResult = AutoburnLogic.AutoburnAction.BURNED;
gemChanged = true;
// Set the inputs according to the unambiguous burning.
// This should trigger burn events on listeners, causing the GemGraph to be re-typed.
AutoburnLogic.BurnCombination burnCombination = autoburnInfo.getBurnCombinations().get(0);
int[] burnArray = burnCombination.getInputsToBurn();
doAutoburnUserAction(thisGem, burnArray);
} else if (autoburnUnifyStatus == AutoburnUnifyStatus.AMBIGUOUS) {