當前位置: 首頁>>代碼示例>>Java>>正文


Java TempList.clear方法代碼示例

本文整理匯總了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();
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:33,代碼來源:Sig.java

示例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();
}
 
開發者ID:AlloyTools,項目名稱:org.alloytools.alloy,代碼行數:50,代碼來源:Sig.java


注:本文中的edu.mit.csail.sdg.alloy4.ConstList.TempList.clear方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。