本文整理汇总了Java中gnu.expr.Language.unionType方法的典型用法代码示例。如果您正苦于以下问题:Java Language.unionType方法的具体用法?Java Language.unionType怎么用?Java Language.unionType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnu.expr.Language
的用法示例。
在下文中一共展示了Language.unionType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculateType
import gnu.expr.Language; //导入方法依赖的package包/类
@Override
protected Type calculateType() {
Type t;
CaseClause clause = clauses.length > 0 ? clauses[0] : null;
if (clause != null) {
t = clause.exp.getType();
for (int i = 1; i < clauses.length; i++) {
clause = clauses[i];
t = Language.unionType(t, clause.exp.getType());
}
t = (elseClause != null) ?
Language.unionType(t, elseClause.exp.getType()) :
Language.unionType(t, Type.voidType);
} else if (elseClause != null)
t = elseClause.exp.getType();
else
throw new Error(
"Syntax Error: Case without any clause, at least a default clause is required");
return t;
}
示例2: calculateDatumsType
import gnu.expr.Language; //导入方法依赖的package包/类
/**
* Computes the union type of the case expression datums.
* Useful to know if the datums are all integer values.
*/
protected Type calculateDatumsType() {
Type t;
boolean atLeastOne = clauses.length > 0 ? true : false;
if (atLeastOne) {
t = calculateDatumType(clauses[0].datums);
for (int i = 1; i < clauses.length; i++) {
t = Language
.unionType(t, calculateDatumType(clauses[i].datums));
}
} else if (elseClause != null)
return Type.voidType;
else
throw new Error();
return t;
}
示例3: calculateDatumType
import gnu.expr.Language; //导入方法依赖的package包/类
/**
* Computes the union type of the datums of a specified
* datum array.
*/
private Type calculateDatumType(Expression[] datum) {
Type t;
t = resolveType(calculateDatumValue(datum[0]));
for (int i = 1; i < datum.length; i++) {
t = Language.unionType(t, resolveType(calculateDatumValue(datum[i])));
}
return t;
}