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


Java IntComparisonFormula.left方法代码示例

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


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

示例1: visit

import kodkod.ast.IntComparisonFormula; //导入方法依赖的package包/类
public Formula visit(IntComparisonFormula formula) { 
	Formula ret = lookup(formula);
	if (ret!=null) return ret;
	
	final IntCompOperator op = formula.op();
	final IntExpression left = formula.left().accept(this);
	final IntExpression 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 IntComparisonFormula) { 
			final IntComparisonFormula hit = (IntComparisonFormula) 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

示例2: visit

import kodkod.ast.IntComparisonFormula; //导入方法依赖的package包/类
/**
 * Calls lookup(intComp) 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: Formula | [[c]] = intComp.left.accept(delegate) op
 *         intComp.right.accept(delegate) }
 */
public Formula visit(IntComparisonFormula intComp) {
	Formula ret = lookup(intComp);
	if (ret != null)
		return ret;

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

示例3: visit

import kodkod.ast.IntComparisonFormula; //导入方法依赖的package包/类
/** 
* Calls lookup(intComp) 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: Formula | [[c]] = intComp.left.accept(this) op intComp.right.accept(this) }
*/
  public Formula visit(IntComparisonFormula intComp) {
Formula ret = lookup(intComp);
if (ret!=null) return ret;

final IntExpression left  = intComp.left().accept(this);
final IntExpression right = intComp.right().accept(this);
ret =  (left==intComp.left() && right==intComp.right()) ? 
		intComp : left.compare(intComp.op(), right);
return cache(intComp,ret);
  }
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:18,代码来源:AbstractReplacer.java

示例4: visit

import kodkod.ast.IntComparisonFormula; //导入方法依赖的package包/类
/** @see #visitFormula(Formula) */
public final Formula visit(IntComparisonFormula cf) {
    //if (visited(cf)) return;
    IntExpression lh = cf.left().accept(this);
    IntExpression rh = cf.right().accept(this);
    if (!negated) {
        if (lh == cf.left() && rh == cf.right()) {
            return addMapping(cf, cf);                
        } else {
            return addMapping(lh.compare(cf.op(), rh), cf);
        }
    } else {
        switch (cf.op()) {
        case GT:
            return addMapping(lh.lte(rh), cf);
        case GTE:
            return addMapping(lh.lt(rh), cf);
        case LT:
            return addMapping(lh.gte(rh), cf);
        case LTE:
            return addMapping(lh.gt(rh), cf);
        case EQ:
            return addMapping(lh.neq(rh), cf);
        case NEQ:
            return addMapping(lh.eq(rh), cf);
        default:   
            return addMapping(cf, cf);
        }            
    }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:31,代码来源:NNFConverter.java

示例5: visit

import kodkod.ast.IntComparisonFormula; //导入方法依赖的package包/类
public Formula visit(IntComparisonFormula formula) { 
	Formula ret = lookup(formula);
	if (ret!=null) return ret;
	
	final IntCompOperator op = formula.op();
	final IntExpression left = formula.left().accept(this);
	final IntExpression 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.IntComparisonFormula.left方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。