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


Java ComparisonFormula类代码示例

本文整理汇总了Java中kodkod.ast.ComparisonFormula的典型用法代码示例。如果您正苦于以下问题:Java ComparisonFormula类的具体用法?Java ComparisonFormula怎么用?Java ComparisonFormula使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: visit

import kodkod.ast.ComparisonFormula; //导入依赖的package包/类
/**
 * Calls lookup(compFormula) and returns the cached value, if any. If a
 * translation has not been cached, translates the formula, calls cache(...)
 * on it and returns it.
 * 
 * @return let t = lookup(compFormula) | some t => t, let op =
 *         (binExpr.op).(SUBSET->subset + EQUALS->eq) | cache(compFormula,
 *         op(compFormula.left.accept(this),
 *         compFormula.right.accept(this)))
 */
public final BooleanValue visit(ComparisonFormula compFormula) {
	BooleanValue ret = lookup(compFormula);
	if (ret != null)
		return ret;

	final BooleanMatrix left = compFormula.left().accept(this);
	final BooleanMatrix right = compFormula.right().accept(this);
	final ExprCompOperator op = compFormula.op();

	switch (op) {
		case SUBSET :
			ret = left.subset(right, env);
			break;
		case EQUALS :
			ret = left.eq(right, env);
			break;
		default :
			throw new IllegalArgumentException("Unknown operator: " + compFormula.op());
	}
	return cache(compFormula, ret);
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:32,代码来源:FOL2BoolTranslator.java

示例2: visit

import kodkod.ast.ComparisonFormula; //导入依赖的package包/类
/** {@inheritDoc} */
public void visit(ComparisonFormula x) {
	String newname = makename(x);
	if (newname == null)
		return;
	String left = make(x.left());
	String right = make(x.right());
	switch (x.op()) {
		case EQUALS :
			file.printf("Formula %s=%s.eq(%s);%n", newname, left, right);
			break;
		case SUBSET :
			file.printf("Formula %s=%s.in(%s);%n", newname, left, right);
			break;
		default :
			throw new RuntimeException("Unknown kodkod operator \"" + x.op() + "\" encountered");
	}
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:19,代码来源:TranslateKodkodToJava.java

示例3: visit

import kodkod.ast.ComparisonFormula; //导入依赖的package包/类
/**
 * Calls lookup(compFormula) and returns the cached value, if any.  
 * If a translation has not been cached, translates the formula,
 * calls cache(...) on it and returns it.
 * @return let t = lookup(compFormula) | some t => t, 
 *      let op = (binExpr.op).(SUBSET->subset + EQUALS->eq) | 
 *       cache(compFormula, op(compFormula.left.accept(this), compFormula.right.accept(this)))
 */
public final BooleanValue visit(ComparisonFormula compFormula) {
	BooleanValue ret = lookup(compFormula);
	if (ret!=null) return ret;

	final BooleanMatrix left = compFormula.left().accept(this);
	final BooleanMatrix right = compFormula.right().accept(this);
	final ExprCompOperator op = compFormula.op();

	switch(op) {
	case SUBSET	: ret = left.subset(right, env); break;
	case EQUALS	: ret = left.eq(right, env); break;
	default : 
		throw new IllegalArgumentException("Unknown operator: " + compFormula.op());
	}
	return cache(compFormula,ret);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:25,代码来源:FOL2BoolTranslator.java

示例4: visit

import kodkod.ast.ComparisonFormula; //导入依赖的package包/类
/**
 * Calls lookup(compFormula) and returns the cached value, if any.  
 * If a translation has not been cached, translates the formula,
 * calls cache(...) on it and returns it.
 * @return let t = lookup(compFormula) | some t => t, 
 *      let op = (binExpr.op).(SUBSET->subset + EQUALS->eq) | 
 *       cache(compFormula, op(compFormula.left.accept(this), compFormula.right.accept(this)))
 */
public final BooleanValue visit(ComparisonFormula compFormula) {
	BooleanValue ret = lookup(compFormula);
	if (ret!=null) return ret;

	final BooleanMatrix left = compFormula.left().accept(this);
	final BooleanMatrix right = compFormula.right().accept(this);
	final ExprCompOperator op = compFormula.op();

	switch(op) {
	case SUBSET	: ret = left.subset(right); break;
	case EQUALS	: ret = left.eq(right); break;
	default : 
		throw new IllegalArgumentException("Unknown operator: " + compFormula.op());
	}
	return cache(compFormula,ret);
}
 
开发者ID:emina,项目名称:kodkod,代码行数:25,代码来源:FOL2BoolTranslator.java

示例5: visit

import kodkod.ast.ComparisonFormula; //导入依赖的package包/类
public Formula visit(ComparisonFormula formula) { 
	Formula ret = lookup(formula);
	if (ret!=null) return ret;
	
	final ExprCompOperator op = formula.op();
	final Expression left = formula.left().accept(this);
	final Expression right = formula.right().accept(this);
	
	if (left==right) return cache(formula,Formula.TRUE);
	
	final int hash = hash(op, left, right);
	for(Iterator<PartialCannonicalizer.Holder<Formula>> itr = formulas.get(hash); itr.hasNext(); ) {
		final Formula next = itr.next().obj;
		if (next instanceof ComparisonFormula) { 
			final ComparisonFormula hit = (ComparisonFormula) next;
			if (hit.op()==op && hit.left()==left && hit.right()==right) { 
				return cache(formula, hit);
			}
		}
	}

	ret = left==formula.left()&&right==formula.right() ? formula : left.compare(op, right);
	formulas.add(new PartialCannonicalizer.Holder<Formula>(ret, hash));
	return cache(formula,ret);
}
 
开发者ID:wala,项目名称:MemSAT,代码行数:26,代码来源:PartialCannonicalizer.java

示例6: visit

import kodkod.ast.ComparisonFormula; //导入依赖的package包/类
/**
 * Calls lookup(compFormula) and returns the cached value, if any. If a
 * replacement has not been cached, visits the formula's children. If
 * nothing changes, the argument is cached and returned, otherwise a
 * replacement formula is cached and returned.
 * 
 * @return { c: ComparisonFormula | c.left =
 *         compFormula.left.accept(delegate) && c.right =
 *         compFormula.right.accept(delegate) && c.op = compFormula.op }
 */
public Formula visit(ComparisonFormula compFormula) {
	Formula ret = lookup(compFormula);
	if (ret != null)
		return ret;

	final Expression left = compFormula.left().accept(delegate);
	final Expression right = compFormula.right().accept(delegate);
	ret = (left == compFormula.left() && right == compFormula.right()) ? compFormula
			: left.compare(compFormula.op(), right);
	return cache(compFormula, ret);
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:22,代码来源:AbstractReplacer.java

示例7: visit

import kodkod.ast.ComparisonFormula; //导入依赖的package包/类
/**
 * Visits the left and right children if this.visited(compFormula) returns
 * false. Otherwise does nothing.
 * 
 * @ensures compFormula.left.accept(this) && compFormula.right.accept(this)
 */
public void visit(ComparisonFormula compFormula) {
	if (visited(compFormula))
		return;
	compFormula.left().accept(this);
	compFormula.right().accept(this);
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:13,代码来源:AbstractVoidVisitor.java

示例8: visit

import kodkod.ast.ComparisonFormula; //导入依赖的package包/类
/**
 * Calls lookup(compFormula) and returns the cached value, if any. If no
 * cached value exists, visits each child, caches the union of the
 * children's return values and returns it.
 * 
 * @return let x = lookup(compFormula) | x != null => x,
 *         cache(compFormula,compFormula.left.accept(this) +
 *         compFormula.right.accept(this))
 */
public Set<T> visit(ComparisonFormula compFormula) {
	Set<T> ret = lookup(compFormula);
	if (ret != null)
		return ret;
	ret = newSet();
	ret.addAll(compFormula.left().accept(this));
	ret.addAll(compFormula.right().accept(this));
	return cache(compFormula, ret);
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:19,代码来源:AbstractCollector.java

示例9: visit

import kodkod.ast.ComparisonFormula; //导入依赖的package包/类
/**
 * Calls super.visit(cf) after disabling skolemization and returns the
 * result.
 * 
 * @return super.visit(cf)
 **/
public final Formula visit(ComparisonFormula cf) {
	final int oldDepth = skolemDepth;
	skolemDepth = -1; // cannot skolemize inside a comparison formula
	final Formula ret = super.visit(cf);
	skolemDepth = oldDepth;
	return source(ret, cf);
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:14,代码来源:Skolemizer.java

示例10: visit

import kodkod.ast.ComparisonFormula; //导入依赖的package包/类
/** {@inheritDoc} */
public void visit(ComparisonFormula x) {
    String newname=makename(x); if (newname==null) return;
    String left=make(x.left());
    String right=make(x.right());
    switch(x.op()) {
       case EQUALS: file.printf("Formula %s=%s.eq(%s);%n", newname, left, right); break;
       case SUBSET: file.printf("Formula %s=%s.in(%s);%n", newname, left, right); break;
       default: throw new RuntimeException("Unknown kodkod operator \""+x.op()+"\" encountered");
    }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:12,代码来源:TranslateKodkodToJava.java

示例11: visit

import kodkod.ast.ComparisonFormula; //导入依赖的package包/类
/** 
 * Calls lookup(compFormula) and returns the cached value, if any.  
 * If a replacement has not been cached, visits the formula's 
 * children.  If nothing changes, the argument is cached and
 * returned, otherwise a replacement formula is cached and returned.
 * @return { c: ComparisonFormula | c.left = compFormula.left.accept(this) &&
 *                                  c.right = compFormula.right.accept(this) &&
 *                                  c.op = compFormula.op }
 */
public Formula visit(ComparisonFormula compFormula) {
	Formula ret = lookup(compFormula);
	if (ret!=null) return ret;
		
	final Expression left  = compFormula.left().accept(this);
	final Expression right = compFormula.right().accept(this);
	ret =  (left==compFormula.left() && right==compFormula.right()) ? 
		   compFormula : left.compare(compFormula.op(), right);	
	return cache(compFormula,ret);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:20,代码来源:AbstractReplacer.java

示例12: visit

import kodkod.ast.ComparisonFormula; //导入依赖的package包/类
/** 
 * Calls lookup(compFormula) and returns the cached value, if any.  
 * If no cached value exists, visits each child, caches the
 * union of the children's return values and returns it. 
 * @return let x = lookup(compFormula) | 
 *          x != null => x,  
 *          cache(compFormula,compFormula.left.accept(this) + compFormula.right.accept(this)) 
 */
public Set<T> visit(ComparisonFormula compFormula) {
	Set<T> ret = lookup(compFormula);
	if (ret!=null) return ret;		
	ret = newSet();
	ret.addAll(compFormula.left().accept(this));
	ret.addAll(compFormula.right().accept(this));
	return cache(compFormula, ret);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:17,代码来源:AbstractCollector.java

示例13: visit

import kodkod.ast.ComparisonFormula; //导入依赖的package包/类
/** 
 * Calls super.visit(cf) after disabling skolemization and returns the result. 
 * @return super.visit(cf) 
 **/
public final Formula visit(ComparisonFormula cf) {
	final int oldDepth = skolemDepth;
	skolemDepth = -1; // cannot skolemize inside a comparison formula
	final Formula ret = super.visit(cf);
	skolemDepth = oldDepth;
	return source(ret,cf);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:12,代码来源:Skolemizer.java

示例14: visit

import kodkod.ast.ComparisonFormula; //导入依赖的package包/类
/** @effects this.tokens' = concat[ this.tokens, tokenize[node.left], node.op, tokenize[node.right] */
public void visit(ComparisonFormula node) {
	if (displayed(node)) return;
	final boolean oldTop = notTop();
	visitChild(node.left(), parenthesize(node.left()));
	infix(node.op());
	visitChild(node.right(), parenthesize(node.right()));
	top = oldTop;
}
 
开发者ID:wala,项目名称:MemSAT,代码行数:10,代码来源:PrettyPrinter.java

示例15: visit

import kodkod.ast.ComparisonFormula; //导入依赖的package包/类
public Formula visit(ComparisonFormula formula) { 
	Formula ret = lookup(formula);
	if (ret!=null) return ret;
	
	final ExprCompOperator op = formula.op();
	final Expression left = formula.left().accept(this);
	final Expression right = formula.right().accept(this);
	
	if (left==right) return cache(formula,Formula.TRUE);
	
	ret = left==formula.left()&&right==formula.right() ? formula : left.compare(op, right);
	return cache(formula,ret);
}
 
开发者ID:wala,项目名称:MemSAT,代码行数:14,代码来源:Simplifier.java


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