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


Java IStrategoTerm.putAttachment方法代码示例

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


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

示例1: 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

示例2: setDesugaredOrigin

import org.spoofax.interpreter.terms.IStrategoTerm; //导入方法依赖的package包/类
public static void setDesugaredOrigin(IStrategoTerm term, IStrategoTerm desugared) {
	/*
	assert(
		DesugaredOriginAttachment.getDesugaredOrigin(term) == null ||
		DesugaredOriginAttachment.getDesugaredOrigin(term) == desugared
	) : "Desugared origin is set only once";
	assert(OriginAttachment.getOrigin(desugared) != null) : 
		"desugared origin term must have an origin term";
	if(DesugaredOriginAttachment.getDesugaredOrigin(term) == null)
	*/
	term.putAttachment(new DesugaredOriginAttachment(desugared));
}
 
开发者ID:metaborg,项目名称:mb-rep,代码行数:13,代码来源:DesugaredOriginAttachment.java

示例3: tryMatchTerms

import org.spoofax.interpreter.terms.IStrategoTerm; //导入方法依赖的package包/类
/**
 * Accomplishes a match between term1 in AST1 and term2 in AST2 if and only if 
 * term1 and term2 are not already matched.
 * @param term1 Term in AST1 
 * @param term2 Term in AST2
 * @return True iff term1 and term2 are matched after this function returns
 */
public static boolean tryMatchTerms(IStrategoTerm term1, IStrategoTerm term2) {
	assert(term1 != term2);
	assert(ParentAttachment.getRoot(term1) != ParentAttachment.getRoot(term2) || ParentAttachment.getRoot(term2) == null);
	if(TermMatchAttachment.getMatchedTerm(term1) == term2){
		return true;
	}
	if(!hasMatchedTerm(term1) && !hasMatchedTerm(term2)){
		term1.putAttachment(new TermMatchAttachment(term2));
		term2.putAttachment(new TermMatchAttachment(term1));
		return true;
	}
	return false;
}
 
开发者ID:metaborg,项目名称:jsglr,代码行数:21,代码来源:TermMatchAttachment.java

示例4: apply

import org.spoofax.interpreter.terms.IStrategoTerm; //导入方法依赖的package包/类
@Override
public void apply(IStrategoTerm term) {
	term.putAttachment(attachment);
}
 
开发者ID:metaborg,项目名称:dynsem,代码行数:5,代码来源:NodeSource.java

示例5: put

import org.spoofax.interpreter.terms.IStrategoTerm; //导入方法依赖的package包/类
public void put(IStrategoTerm term) {
    term.putAttachment(getImploderAttachment());
}
 
开发者ID:metaborg,项目名称:nabl,代码行数:4,代码来源:TermOrigin.java


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