当前位置: 首页>>代码示例>>Java>>正文


Java Expressions.isStringLiteral方法代码示例

本文整理汇总了Java中com.sri.ai.expresso.helper.Expressions.isStringLiteral方法的典型用法代码示例。如果您正苦于以下问题:Java Expressions.isStringLiteral方法的具体用法?Java Expressions.isStringLiteral怎么用?Java Expressions.isStringLiteral使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sri.ai.expresso.helper.Expressions的用法示例。


在下文中一共展示了Expressions.isStringLiteral方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: assertNameOk

import com.sri.ai.expresso.helper.Expressions; //导入方法依赖的package包/类
private static void assertNameOk(Expression name) {
	boolean illegal = true;
	if (Expressions.isSymbol(name)
		&& name.getValue() instanceof String
		// Ensure is not an in-built sort
		&& !isNameOfInBuilt(name)
		// Ensure is not a String Literal
		&& !Expressions.isStringLiteral(name)
		) {
		
		illegal = false;
	}
	if (illegal) {
		throw new IllegalArgumentException(
				"Model sort name '"
						+ name
						+ "' is not of the correct type. It must be a string-valued symbol.");
	}
}
 
开发者ID:aic-sri-international,项目名称:aic-praise,代码行数:20,代码来源:HOGMSortDeclaration.java

示例2: isSortReference

import com.sri.ai.expresso.helper.Expressions; //导入方法依赖的package包/类
public static boolean isSortReference(Expression reference) {
	boolean result = false;
	
	if ((Expressions.isSymbol(reference) && reference.getValue() instanceof String && !Expressions.isStringLiteral(reference)) ||
	    isIntegerIntervalReference(reference) ||
	    isRealIntervalReference(reference)) {
		result = true;
	}
	
	return result;
}
 
开发者ID:aic-sri-international,项目名称:aic-praise,代码行数:12,代码来源:HOGMSortDeclaration.java

示例3: assertNameOk

import com.sri.ai.expresso.helper.Expressions; //导入方法依赖的package包/类
private static void assertNameOk(Expression name) {
	boolean illegal = true;
	if (Expressions.isSymbol(name)
		&& name.getValue() instanceof String
		// Ensure is not a String Literal
		&& !Expressions.isStringLiteral(name)) {
		illegal = false;
	}
	if (illegal) {
		throw new IllegalArgumentException(
				"name ["
						+ name
						+ "] is not of the correct type. must be a string valued symbol.");
	}
}
 
开发者ID:aic-sri-international,项目名称:aic-praise,代码行数:16,代码来源:HOGMRandomVariableDeclaration.java

示例4: validSortConstants

import com.sri.ai.expresso.helper.Expressions; //导入方法依赖的package包/类
boolean validSortConstants(StatementInfo sortStatement) {
	boolean result = true;	
	for (Expression constant : ExtensionalSets.getElements(sortStatement.statement.get(2))) {
		if (Expressions.isStringLiteral(constant)) {
			result = false;
			newError(Type.SORT_CONSTANT_NAME_CANNOT_BE_A_STRING_LITERAL, ""+constant, sortStatement);
		}
	}
	return result;
}
 
开发者ID:aic-sri-international,项目名称:aic-praise,代码行数:11,代码来源:HOGModel.java

示例5: isUnknownConstant

import com.sri.ai.expresso.helper.Expressions; //导入方法依赖的package包/类
boolean isUnknownConstant(Expression expr, Map<Expression, ConstantDeclaration> scopedConstants) {
	boolean result = Expressions.isSymbol(expr) &&
					!Expressions.isNumber(expr) &&
					!isQuantifiedExpression(expr) &&
					!scopedConstants.containsKey(expr) &&
					!randoms.containsKey(expr) &&
					!sorts.containsKey(expr) &&
					!sortConstants.contains(expr) &&
					!Expressions.isStringLiteral(expr);
	return result;
}
 
开发者ID:aic-sri-international,项目名称:aic-praise,代码行数:12,代码来源:HOGModel.java

示例6: assertNameOk

import com.sri.ai.expresso.helper.Expressions; //导入方法依赖的package包/类
private static void assertNameOk(Expression name) {
	boolean illegal = true;
	if (Expressions.isSymbol(name)
		&& name.getValue() instanceof String
		// Ensure is not a String Literal
		&& !Expressions.isStringLiteral(name)) {
		illegal = false;
	}
	if (illegal) {
		throw new IllegalArgumentException(
				"name ["
						+ name
						+ "] is not of the correct type. must be a correctly formed string valued symbol.");
	}
}
 
开发者ID:aic-sri-international,项目名称:aic-praise,代码行数:16,代码来源:ConstantDeclaration.java

示例7: assertConstantsOk

import com.sri.ai.expresso.helper.Expressions; //导入方法依赖的package包/类
private static void assertConstantsOk(Expression name, Expression size,
		Expression constants) {
	boolean illegal = true;

	if (Sets.isExtensionalUniSet(constants)) {
		boolean argsOk = true;
		Set<Expression> seen = new LinkedHashSet<Expression>();
		for (Expression arg : ExtensionalSets.getElements(constants)) {
			// Each constant must be a symbol.
			if (!(arg.getSyntacticFormType().equals(Symbol.SYNTACTIC_FORM_TYPE))) {
				argsOk = false;
			}
			// Constants should be declared unique within the set expression
			if (seen.contains(arg)) {
				argsOk = false;
			}
			// Constant can't have same name as the sort its contained in
			if (name.equals(arg)) {
				argsOk = false;
			}
			// Constant can't be a string literal
			if (Expressions.isStringLiteral(arg)) {
				argsOk = false;
			}

			if (!argsOk) {
				break;
			}

			seen.add(arg);
		}

		if (argsOk) {
			if (!UNKNOWN_SIZE.equals(size)) {
				if (seen.size() <= size.intValue()) {
					illegal = false;
				}
			} 
			else {
				illegal = false;
			}
		}
	}

	if (illegal) {
		throw new IllegalArgumentException(
				"constants ["
						+ constants
						+ "] is not of the correct type. must be an extensional uni-set of symbols representing unique constants in the model.");
	}
}
 
开发者ID:aic-sri-international,项目名称:aic-praise,代码行数:52,代码来源:HOGMSortDeclaration.java


注:本文中的com.sri.ai.expresso.helper.Expressions.isStringLiteral方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。