当前位置: 首页>>代码示例>>Java>>正文


Java IStrategoTerm.getStorageType方法代码示例

本文整理汇总了Java中org.spoofax.interpreter.terms.IStrategoTerm.getStorageType方法的典型用法代码示例。如果您正苦于以下问题:Java IStrategoTerm.getStorageType方法的具体用法?Java IStrategoTerm.getStorageType怎么用?Java IStrategoTerm.getStorageType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.spoofax.interpreter.terms.IStrategoTerm的用法示例。


在下文中一共展示了IStrategoTerm.getStorageType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getStorageType

import org.spoofax.interpreter.terms.IStrategoTerm; //导入方法依赖的package包/类
protected int getStorageType(IStrategoTerm[] terms) {
	int result = defaultStorageType;
	for (IStrategoTerm term : terms) {
		int type = term.getStorageType();
		if (type < result) { 
    		if (type == 0) return 0;
			result = type;
		}
	}
	return result;
}
 
开发者ID:metaborg,项目名称:mb-rep,代码行数:12,代码来源:AbstractTermFactory.java

示例2: copyAttachments

import org.spoofax.interpreter.terms.IStrategoTerm; //导入方法依赖的package包/类
public IStrategoTerm copyAttachments(IStrategoTerm from, IStrategoTerm to) {
 	if (to.getStorageType() != MUTABLE)
 		throw new IllegalArgumentException("Target term is not mutable and does not support attachments");
 	ITermAttachment attach = from.getAttachment(null);
 	while (attach != null) {
 		try {
	to.putAttachment(attach.clone());
} catch (CloneNotSupportedException e) {
	throw new IllegalArgumentException("Copying attachments of this type is not supported: " + attach.getAttachmentType(), e);
}
 		attach = attach.getNext();
 	}
 	return to;
 }
 
开发者ID:metaborg,项目名称:mb-rep,代码行数:15,代码来源:AbstractTermFactory.java

示例3: makeLinkDesugared

import org.spoofax.interpreter.terms.IStrategoTerm; //导入方法依赖的package包/类
/**
 * @param origin
 *            The origin term. For lists, this must be the exact
 *            corresponding term with the same offset and length.
 */
public IStrategoTerm makeLinkDesugared(IStrategoTerm term, IStrategoTerm desugared) {
	if (!term.isList() && DesugaredOriginAttachment.get(term) == null) {
		if (term.getStorageType() == MUTABLE)
			DesugaredOriginAttachment.setDesugaredOrigin(term, desugared);
	} else if (REASSIGN_ORIGINS) {
		throw new NotImplementedException("Not implemented: unwrapping of possibly already wrapped term");
	}
	return term;
}
 
开发者ID:metaborg,项目名称:mb-rep,代码行数:15,代码来源:OriginTermFactory.java

示例4: match

import org.spoofax.interpreter.terms.IStrategoTerm; //导入方法依赖的package包/类
/**
   * Equality test.
   * 
   * @note
   *   For {@link #SHARABLE} terms if a term 'x' is matched with multiple times,
   *   it should always appear as the argument of the match calls.
   *   Likewise, longer-lived terms should appear in this position. 
   */
  public final boolean match(IStrategoTerm second) {
  	if (this == second) return true;
  	if (second == null) return false;
      
  	int storageType = getStorageType();
      
switch (storageType) {
      	case MAXIMALLY_SHARED:
      		switch (second.getStorageType()) {
			case MAXIMALLY_SHARED:
				return false;
			case SHARABLE:
				// (common storage type is immutable, i.e. my subterms should not be overwritten)
				return hashCode() == second.hashCode() && doSlowMatch(second, IMMUTABLE);
			case IMMUTABLE:
				return hashCode() == second.hashCode() && doSlowMatch(second, IMMUTABLE);
   			default:
   				return doSlowMatch(second, MUTABLE);
   		}
      	case SHARABLE:
      	case IMMUTABLE:
      		switch (second.getStorageType()) {
  				case MAXIMALLY_SHARED:
  					return hashCode() == second.hashCode() && doSlowMatch(second, storageType);
  				case SHARABLE:
  					return hashCode() == second.hashCode() && doSlowMatch(second, storageType);
  				case IMMUTABLE:
  					return hashCode() == second.hashCode() && doSlowMatch(second, IMMUTABLE);
      			default:
      				return doSlowMatch(second, MUTABLE);
      		}
      	default:
   			return doSlowMatch(second, MUTABLE);
      }
  }
 
开发者ID:metaborg,项目名称:mb-rep,代码行数:44,代码来源:StrategoTerm.java


注:本文中的org.spoofax.interpreter.terms.IStrategoTerm.getStorageType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。