use of com.sri.ai.grinder.library.indexexpression.IndexExpressions in project aic-expresso by aic-sri-international.
the class Expressions method makeDefaultIntensionalMultiSetFromLabelAndSubTrees.
private static Expression makeDefaultIntensionalMultiSetFromLabelAndSubTrees(Object label, Object[] subTreeObjects) {
if (subTreeObjects.length == 1 && subTreeObjects[0] instanceof Collection) {
subTreeObjects = ((Collection) subTreeObjects[0]).toArray();
}
ArrayList<Expression> subTreeExpressions = Util.mapIntoArrayList(subTreeObjects, Expressions::makeFromObject);
if (subTreeExpressions.size() == 1) {
subTreeExpressions = new ArrayList<Expression>(Expressions.ensureListFromKleeneList(subTreeExpressions.get(0)));
}
Expression scopingExpression = subTreeExpressions.get(0);
IndexExpressionsSet indexExpressions = new ExtensionalIndexExpressionsSet((scopingExpression == null || scopingExpression.numberOfArguments() == 0) ? Util.list() : new ArrayList<Expression>(Expressions.ensureListFromKleeneList(scopingExpression.get(0))));
Expression conditioningSyntaxTree = subTreeExpressions.get(2);
Expression condition = conditioningSyntaxTree == null ? Expressions.TRUE : conditioningSyntaxTree.get(0);
Expression result = new DefaultIntensionalMultiSet(indexExpressions, subTreeExpressions.get(1), condition);
return result;
}
use of com.sri.ai.grinder.library.indexexpression.IndexExpressions in project aic-expresso by aic-sri-international.
the class Expressions method makeDefaultLambdaExpressionFromLabelAndSubTrees.
private static Expression makeDefaultLambdaExpressionFromLabelAndSubTrees(Object label, Object[] subTreeObjects) {
ArrayList<Expression> subTreeExpressions = Util.mapIntoArrayList(subTreeObjects, Expressions::makeFromObject);
Expression indexExpressionsKleeneList = subTreeExpressions.get(0);
IndexExpressionsSet indexExpressions = new ExtensionalIndexExpressionsSet(ensureListFromKleeneList(indexExpressionsKleeneList));
Expression body = subTreeExpressions.get(1);
Expression result = new DefaultLambdaExpression(indexExpressions, body);
return result;
}
use of com.sri.ai.grinder.library.indexexpression.IndexExpressions in project aic-expresso by aic-sri-international.
the class Expressions method makeDefaultCountingFormulaExpressionFromLabelAndSubTrees.
private static Expression makeDefaultCountingFormulaExpressionFromLabelAndSubTrees(Object label, Object[] subTreeObjects) {
ArrayList<Expression> subTreeExpressions = Util.mapIntoArrayList(subTreeObjects, Expressions::makeFromObject);
Expression indexExpressionsKleeneList = subTreeExpressions.get(0);
IndexExpressionsSet indexExpressions = new ExtensionalIndexExpressionsSet(ensureListFromKleeneList(indexExpressionsKleeneList));
Expression body = subTreeExpressions.get(1);
Expression result = new DefaultCountingFormula(indexExpressions, body);
return result;
}
use of com.sri.ai.grinder.library.indexexpression.IndexExpressions in project aic-expresso by aic-sri-international.
the class Expressions method makeDefaultExistentiallyQuantifiedFormulaFromLabelAndSubTrees.
private static Expression makeDefaultExistentiallyQuantifiedFormulaFromLabelAndSubTrees(Object label, Object[] subTreeObjects) {
ArrayList<Expression> subTreeExpressions = Util.mapIntoArrayList(subTreeObjects, Expressions::makeFromObject);
Expression indexExpressionsKleeneList = subTreeExpressions.get(0);
IndexExpressionsSet indexExpressions = new ExtensionalIndexExpressionsSet(ensureListFromKleeneList(indexExpressionsKleeneList));
Expression body = subTreeExpressions.get(1);
Expression result = new DefaultExistentiallyQuantifiedFormula(indexExpressions, body);
return result;
}
use of com.sri.ai.grinder.library.indexexpression.IndexExpressions in project aic-expresso by aic-sri-international.
the class Expressions method makeDefaultIntensionalUniSetFromLabelAndSubTrees.
private static Expression makeDefaultIntensionalUniSetFromLabelAndSubTrees(Object label, Object[] subTreeObjects) {
if (subTreeObjects.length == 1 && subTreeObjects[0] instanceof Collection) {
subTreeObjects = ((Collection) subTreeObjects[0]).toArray();
}
ArrayList<Expression> subTreeExpressions = Util.mapIntoArrayList(subTreeObjects, Expressions::makeFromObject);
if (subTreeExpressions.size() == 1) {
subTreeExpressions = new ArrayList<Expression>(Expressions.ensureListFromKleeneList(subTreeExpressions.get(0)));
}
Expression scopingExpression = subTreeExpressions.get(0);
IndexExpressionsSet indexExpressions = new ExtensionalIndexExpressionsSet((scopingExpression == null || scopingExpression.numberOfArguments() == 0) ? Util.list() : new ArrayList<Expression>(Expressions.ensureListFromKleeneList(scopingExpression.get(0))));
Expression conditioningSyntaxTree = subTreeExpressions.get(2);
Expression condition = conditioningSyntaxTree == null ? Expressions.TRUE : conditioningSyntaxTree.get(0);
Expression result = new DefaultIntensionalUniSet(indexExpressions, subTreeExpressions.get(1), condition);
return result;
}
Aggregations