本文整理汇总了Java中edu.mit.csail.sdg.alloy4.ConstList.TempList.clear方法的典型用法代码示例。如果您正苦于以下问题:Java TempList.clear方法的具体用法?Java TempList.clear怎么用?Java TempList.clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.mit.csail.sdg.alloy4.ConstList.TempList
的用法示例。
在下文中一共展示了TempList.clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SubsetSig
import edu.mit.csail.sdg.alloy4.ConstList.TempList; //导入方法依赖的package包/类
/** Constructs a subset sig.
*
* @param label - the name of this sig (it does not need to be unique)
* @param parents - the list of parents (if this list is null or empty, we assume the caller means UNIV)
* @param attributes - the list of optional attributes such as EXACT, SUBSET, LONE, ONE, SOME, PRIVATE, or META
*
* @throws ErrorSyntax if the signature has two or more multiplicities
* @throws ErrorType if parents only contains NONE
*/
public SubsetSig(String label, Collection<Sig> parents, Attr... attributes) throws Err {
super(getType(label,parents), label, Util.append(attributes, Attr.SUBSET));
if (isEnum!=null) throw new ErrorType(pos, "Subset signature cannot be an enum.");
boolean exact = false;
for(Attr a: attributes) if (a!=null && a.type==AttrType.EXACT) exact = true;
this.exact = exact;
TempList<Sig> temp = new TempList<Sig>(parents==null ? 1 : parents.size());
if (parents==null || parents.size()==0) {
temp.add(UNIV);
} else {
for(Sig parent:parents) {
if (!Version.experimental) {
if (parent==SIGINT) throw new ErrorSyntax(pos, "sig "+label+" cannot be a subset of the builtin \"Int\" signature");
if (parent==SEQIDX) throw new ErrorSyntax(pos, "sig "+label+" cannot be a subset of the builtin \"seq/Int\" signature");
if (parent==STRING) throw new ErrorSyntax(pos, "sig "+label+" cannot be a subset of the builtin \"String\" signature");
}
if (parent==Sig.UNIV) {temp.clear(); temp.add(UNIV); break;}
if (parent!=Sig.NONE && !temp.contains(parent)) temp.add(parent);
}
}
if (temp.size()==0) throw new ErrorType(pos, "Sig "+label+" must have at least one non-empty parent.");
this.parents = temp.makeConst();
}
示例2: SubsetSig
import edu.mit.csail.sdg.alloy4.ConstList.TempList; //导入方法依赖的package包/类
/**
* Constructs a subset sig.
*
* @param label - the name of this sig (it does not need to be unique)
* @param parents - the list of parents (if this list is null or empty,
* we assume the caller means UNIV)
* @param attributes - the list of optional attributes such as EXACT,
* SUBSET, LONE, ONE, SOME, PRIVATE, or META
* @throws ErrorSyntax if the signature has two or more multiplicities
* @throws ErrorType if parents only contains NONE
*/
public SubsetSig(String label, Collection<Sig> parents, Attr... attributes) throws Err {
super(getType(label, parents), label, Util.append(attributes, Attr.SUBSET));
if (isEnum != null)
throw new ErrorType(pos, "Subset signature cannot be an enum.");
boolean exact = false;
for (Attr a : attributes)
if (a != null && a.type == AttrType.EXACT)
exact = true;
this.exact = exact;
TempList<Sig> temp = new TempList<Sig>(parents == null ? 1 : parents.size());
if (parents == null || parents.size() == 0) {
temp.add(UNIV);
} else {
for (Sig parent : parents) {
if (!Version.experimental) {
if (parent == SIGINT)
throw new ErrorSyntax(pos,
"sig " + label + " cannot be a subset of the builtin \"Int\" signature");
if (parent == SEQIDX)
throw new ErrorSyntax(pos,
"sig " + label + " cannot be a subset of the builtin \"seq/Int\" signature");
if (parent == STRING)
throw new ErrorSyntax(pos,
"sig " + label + " cannot be a subset of the builtin \"String\" signature");
}
if (parent == Sig.UNIV) {
temp.clear();
temp.add(UNIV);
break;
}
if (parent != Sig.NONE && !temp.contains(parent))
temp.add(parent);
}
}
if (temp.size() == 0)
throw new ErrorType(pos, "Sig " + label + " must have at least one non-empty parent.");
this.parents = temp.makeConst();
}