本文整理汇总了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.");
}
}
示例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;
}
示例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.");
}
}
示例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;
}
示例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;
}
示例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.");
}
}
示例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.");
}
}