當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。