當前位置: 首頁>>代碼示例>>Java>>正文


Java Expressions.makeExpressionOnSyntaxTreeWithLabelAndSubTrees方法代碼示例

本文整理匯總了Java中com.sri.ai.expresso.helper.Expressions.makeExpressionOnSyntaxTreeWithLabelAndSubTrees方法的典型用法代碼示例。如果您正苦於以下問題:Java Expressions.makeExpressionOnSyntaxTreeWithLabelAndSubTrees方法的具體用法?Java Expressions.makeExpressionOnSyntaxTreeWithLabelAndSubTrees怎麽用?Java Expressions.makeExpressionOnSyntaxTreeWithLabelAndSubTrees使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.sri.ai.expresso.helper.Expressions的用法示例。


在下文中一共展示了Expressions.makeExpressionOnSyntaxTreeWithLabelAndSubTrees方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: visitPropositionalRandomVariableDeclaration

import com.sri.ai.expresso.helper.Expressions; //導入方法依賴的package包/類
@Override 
public Expression visitPropositionalRandomVariableDeclaration(HOGMParser.PropositionalRandomVariableDeclarationContext ctx) { 
	Expression name  = newSymbol(ctx.name.getText());
	Expression arity = Expressions.ZERO;
	Expression range = visit(ctx.range);

	List<Expression> declarationArgs = new ArrayList<Expression>();
	declarationArgs.add(name);
	declarationArgs.add(arity);
	declarationArgs.add(range);

	Expression result = Expressions.makeExpressionOnSyntaxTreeWithLabelAndSubTrees(
			HOGMRandomVariableDeclaration.FUNCTOR_RANDOM_VARIABLE_DECLARATION,
			declarationArgs.toArray());
	
	randomVariableDeclarations.add(newStatementInfo(result, ctx));

	return result; 
}
 
開發者ID:aic-sri-international,項目名稱:aic-praise,代碼行數:20,代碼來源:HOGModelVisitor.java

示例2: getConstantDeclaration

import com.sri.ai.expresso.helper.Expressions; //導入方法依賴的package包/類
/**
 * 
 * @return an expression representing the full constant declaration.
 */
public Expression getConstantDeclaration() {
	// Lazy initialize this attribute
	if (constantDeclaration == null) {
		List<Expression> declarationArgs = new ArrayList<Expression>();
		declarationArgs.add(name);
		declarationArgs.add(arity);
		declarationArgs.addAll(parameters);
		declarationArgs.add(range);

		constantDeclaration = Expressions.makeExpressionOnSyntaxTreeWithLabelAndSubTrees(
				FUNCTOR_CONSTANT_DECLARATION,
				declarationArgs.toArray());
	}

	return constantDeclaration;
}
 
開發者ID:aic-sri-international,項目名稱:aic-praise,代碼行數:21,代碼來源:ConstantDeclaration.java

示例3: visitRelationalRandomVariableDeclaration

import com.sri.ai.expresso.helper.Expressions; //導入方法依賴的package包/類
@Override 
public Expression visitRelationalRandomVariableDeclaration(HOGMParser.RelationalRandomVariableDeclarationContext ctx) { 
	Expression name = newSymbol(ctx.name.getText());
	List<Expression> parameters = expressionsList(ctx.parameters);
	Expression arity = Expressions.makeSymbol(parameters.size());
	Expression range = visit(ctx.range);

	List<Expression> declarationArgs = new ArrayList<Expression>();
	declarationArgs.add(name);
	declarationArgs.add(arity);
	declarationArgs.addAll(parameters);
	declarationArgs.add(range);

	Expression result = Expressions.makeExpressionOnSyntaxTreeWithLabelAndSubTrees(
			HOGMRandomVariableDeclaration.FUNCTOR_RANDOM_VARIABLE_DECLARATION,
			declarationArgs.toArray());
	
	randomVariableDeclarations.add(newStatementInfo(result, ctx));

	return result;
}
 
開發者ID:aic-sri-international,項目名稱:aic-praise,代碼行數:22,代碼來源:HOGModelVisitor.java

示例4: getRandomVariableDeclaration

import com.sri.ai.expresso.helper.Expressions; //導入方法依賴的package包/類
/**
 * 
 * @return an expression representing the full random variable declaration.
 */
public Expression getRandomVariableDeclaration() {
	// Lazy initialize this attribute
	if (randomVariableDeclaration == null) {
		List<Expression> declarationArgs = new ArrayList<Expression>();
		declarationArgs.add(name);
		declarationArgs.add(arity);
		declarationArgs.addAll(parameters);
		declarationArgs.add(range);

		randomVariableDeclaration = Expressions.makeExpressionOnSyntaxTreeWithLabelAndSubTrees(
				FUNCTOR_RANDOM_VARIABLE_DECLARATION,
				declarationArgs.toArray());
	}

	return randomVariableDeclaration;
}
 
開發者ID:aic-sri-international,項目名稱:aic-praise,代碼行數:21,代碼來源:HOGMRandomVariableDeclaration.java

示例5: visitRelationalConstantDeclaration

import com.sri.ai.expresso.helper.Expressions; //導入方法依賴的package包/類
@Override 
public Expression visitRelationalConstantDeclaration(HOGMParser.RelationalConstantDeclarationContext ctx) { 
	Expression name = newSymbol(ctx.name.getText());
	List<Expression> parameters = expressionsList(ctx.parameters);
	Expression arity = Expressions.makeSymbol(parameters.size());
	Expression range = visit(ctx.range);

	List<Expression> declarationArgs = new ArrayList<Expression>();
	declarationArgs.add(name);
	declarationArgs.add(arity);
	declarationArgs.addAll(parameters);
	declarationArgs.add(range);

	Expression result = Expressions.makeExpressionOnSyntaxTreeWithLabelAndSubTrees(
			ConstantDeclaration.FUNCTOR_CONSTANT_DECLARATION,
			declarationArgs.toArray());
	
	constantDeclarations.add(newStatementInfo(result, ctx));

	return result;
}
 
開發者ID:aic-sri-international,項目名稱:aic-praise,代碼行數:22,代碼來源:HOGModelVisitor.java

示例6: visitSort_decl

import com.sri.ai.expresso.helper.Expressions; //導入方法依賴的package包/類
@Override 
public Expression visitSort_decl(HOGMParser.Sort_declContext ctx) { 
	Expression name = newSymbol(ctx.name.getText());
	Expression size = HOGMSortDeclaration.UNKNOWN_SIZE;
	if (ctx.size != null) {
		size = newSymbol(ctx.size.getText());
	}
	List<Expression> constants = new ArrayList<Expression>();
	if (ctx.constants != null) {
		ctx.constants.forEach(c -> constants.add(newSymbol(c.getText())));
	}
	
	Expression result = Expressions.makeExpressionOnSyntaxTreeWithLabelAndSubTrees(
			HOGMSortDeclaration.FUNCTOR_SORT_DECLARATION, name, size,
			ExtensionalSets.makeUniSet(constants));
	
	sortDeclarations.add(newStatementInfo(result, ctx));
	
	return result;
}
 
開發者ID:aic-sri-international,項目名稱:aic-praise,代碼行數:21,代碼來源:HOGModelVisitor.java

示例7: getSortDeclaration

import com.sri.ai.expresso.helper.Expressions; //導入方法依賴的package包/類
/**
 * 
 * @return an expression representing the full sort declaration.
 */
public Expression getSortDeclaration() {
	// Lazy initialize this attribute
	if (sortDeclaration == null) {
		sortDeclaration = Expressions.makeExpressionOnSyntaxTreeWithLabelAndSubTrees(FUNCTOR_SORT_DECLARATION, name,
				size, constants);
	}

	return sortDeclaration;
}
 
開發者ID:aic-sri-international,項目名稱:aic-praise,代碼行數:14,代碼來源:HOGMSortDeclaration.java

示例8: normalize

import com.sri.ai.expresso.helper.Expressions; //導入方法依賴的package包/類
/**
 * Returns X = c, if 'expression' is c = X, for X a variable and c a constant, or 'expression' otherwise.
 * It actually works for any other functor as well. 
 */
public static Expression normalize(Expression expression, Context context) {
	if (expression.numberOfArguments() == 2
			&& context.isUniquelyNamedConstant(expression.get(0))) {
		if ( ! context.isUniquelyNamedConstant(expression.get(1))) {
			Expression result = Expressions.makeExpressionOnSyntaxTreeWithLabelAndSubTrees(expression.getFunctor(), expression.get(1), expression.get(0));
			return result;
		}
	}
	return expression;
}
 
開發者ID:aic-sri-international,項目名稱:aic-expresso,代碼行數:15,代碼來源:Equality.java

示例9: visitMultiplicationOrDivisionOrIntegerInterval

import com.sri.ai.expresso.helper.Expressions; //導入方法依賴的package包/類
@Override
public Expression visitMultiplicationOrDivisionOrIntegerInterval(AntlrGrinderParser.MultiplicationOrDivisionOrIntegerIntervalContext ctx) {
	Expression result;	
	if (ctx.op.getText().equals("..")) {			
		result = apply(INTEGER_INTERVAL, visit(ctx.leftop), visit(ctx.rightop));
		// result = Expressions.makeExpressionOnSyntaxTreeWithLabelAndSubTrees(FunctorConstants.INTEGER_INTERVAL, visit(ctx.leftop), visit(ctx.rightop));
		// using the above line places extra quotes around '..', not sure why.
	}
	else {			
		result = Expressions.makeExpressionOnSyntaxTreeWithLabelAndSubTrees(ctx.op.getText(), visit(ctx.leftop), visit(ctx.rightop));
	}		
	result = possiblyFlatten(result);
	return result;
}
 
開發者ID:aic-sri-international,項目名稱:aic-expresso,代碼行數:15,代碼來源:ExpressionVisitor.java

示例10: visitUnaryMinus

import com.sri.ai.expresso.helper.Expressions; //導入方法依賴的package包/類
@Override 
public Expression visitUnaryMinus(HOGMParser.UnaryMinusContext ctx) { 
Expression argument = visit(ctx.term());
Expression result;
if (argument.getValue() instanceof Number) {
	result = Expressions.makeSymbol(argument.rationalValue().negate());
}
else {
	result = Expressions.makeExpressionOnSyntaxTreeWithLabelAndSubTrees(MINUS, argument);
}
return result;
}
 
開發者ID:aic-sri-international,項目名稱:aic-praise,代碼行數:13,代碼來源:HOGModelVisitor.java

示例11: visitIntersection

import com.sri.ai.expresso.helper.Expressions; //導入方法依賴的package包/類
@Override
public Expression visitIntersection(
		AntlrGrinderParser.IntersectionContext ctx) {
	Expression result = Expressions.makeExpressionOnSyntaxTreeWithLabelAndSubTrees(FunctorConstants.INTERSECTION, visit(ctx.leftop), visit(ctx.rightop));
	result = possiblyFlatten(result);
	return result;
}
 
開發者ID:aic-sri-international,項目名稱:aic-expresso,代碼行數:8,代碼來源:ExpressionVisitor.java

示例12: visitSort_real_interval

import com.sri.ai.expresso.helper.Expressions; //導入方法依賴的package包/類
@Override 
public Expression visitSort_real_interval(HOGMParser.Sort_real_intervalContext ctx) { 
	String intervalType;
	if (ctx.lower_bracket.getText().equals("[")) {
		if (ctx.upper_bracket.getText().equals("]")) {
			intervalType = REAL_INTERVAL_CLOSED_CLOSED;
		}
		else { // upper bracket is open i.e. [
			intervalType = REAL_INTERVAL_CLOSED_OPEN;
		}
	}  		
	else { // Lower bracket is open i.e. ]
		if (ctx.upper_bracket.getText().equals("]")) {
			intervalType = REAL_INTERVAL_OPEN_CLOSED;
		}
		else { // upper bracket is open i.e. [
			intervalType = REAL_INTERVAL_OPEN_OPEN;
		}
	}
	Rational lower = new Rational(ctx.lower.getText());
	if (ctx.negate_lower != null) {
		lower = lower.negate();
	}
	Rational upper = new Rational(ctx.upper.getText());
	if (ctx.negate_upper != null) {
		upper = upper.negate();
	}
	Expression result = Expressions.makeExpressionOnSyntaxTreeWithLabelAndSubTrees(intervalType, Expressions.makeSymbol(lower), Expressions.makeSymbol(upper));
	return result;
}
 
開發者ID:aic-sri-international,項目名稱:aic-praise,代碼行數:31,代碼來源:HOGModelVisitor.java

示例13: visitCardinality

import com.sri.ai.expresso.helper.Expressions; //導入方法依賴的package包/類
@Override
public Expression visitCardinality(AntlrGrinderParser.CardinalityContext ctx) {
	Expression result = Expressions.makeExpressionOnSyntaxTreeWithLabelAndSubTrees(FunctorConstants.CARDINALITY, visit(ctx.expr()));
	return result;
}
 
開發者ID:aic-sri-international,項目名稱:aic-expresso,代碼行數:6,代碼來源:ExpressionVisitor.java

示例14: visitAdditionOrSubtraction

import com.sri.ai.expresso.helper.Expressions; //導入方法依賴的package包/類
@Override
public Expression visitAdditionOrSubtraction(AntlrGrinderParser.AdditionOrSubtractionContext ctx) {
	Expression result = Expressions.makeExpressionOnSyntaxTreeWithLabelAndSubTrees(ctx.op.getText(), visit(ctx.leftop), visit(ctx.rightop));
	result = possiblyFlatten(result);
	return result;
}
 
開發者ID:aic-sri-international,項目名稱:aic-expresso,代碼行數:7,代碼來源:ExpressionVisitor.java

示例15: makeMultiSet

import com.sri.ai.expresso.helper.Expressions; //導入方法依賴的package包/類
public static Expression makeMultiSet(List<Expression> elements) {
	return Expressions.makeExpressionOnSyntaxTreeWithLabelAndSubTrees(MULTI_SET_LABEL, Expressions.makeKleeneListIfNeeded(elements));
}
 
開發者ID:aic-sri-international,項目名稱:aic-expresso,代碼行數:4,代碼來源:ExtensionalSets.java


注:本文中的com.sri.ai.expresso.helper.Expressions.makeExpressionOnSyntaxTreeWithLabelAndSubTrees方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。