Java Code Examples for kodkod.ast.SumExpression#decls()

The following examples show how to use kodkod.ast.SumExpression#decls() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Skolemizer.java    From org.alloytools.alloy with Apache License 2.0 6 votes vote down vote up
/**
 * @see kodkod.ast.visitor.AbstractReplacer#visit(kodkod.ast.SumExpression)
 */
@Override
public final IntExpression visit(SumExpression intExpr) {
    IntExpression ret = lookup(intExpr);
    if (ret != null)
        return ret;
    final Environment<Expression,Expression> oldRepEnv = repEnv; // skolemDepth
                                                                // < 0
                                                                // at
                                                                // this
                                                                // point
    final Decls decls = visit(intExpr.decls());
    final IntExpression expr = intExpr.intExpr().accept(this);
    ret = (decls == intExpr.decls() && expr == intExpr.intExpr()) ? intExpr : expr.sum(decls);
    repEnv = oldRepEnv;
    return cache(intExpr, ret);
}
 
Example 2
Source File: AbstractReplacer.java    From org.alloytools.alloy with Apache License 2.0 5 votes vote down vote up
/**
 * Calls lookup(intExpr) and returns the cached value, if any. If a replacement
 * has not been cached, visits the expression's children. If nothing changes,
 * the argument is cached and returned, otherwise a replacement expression is
 * cached and returned.
 *
 * @return { c: IntExpression | [[c]] = sum intExpr.decls.accept(delegate) |
 *         intExpr.intExpr.accept(delegate) }
 */
@Override
public IntExpression visit(SumExpression intExpr) {
    IntExpression ret = lookup(intExpr);
    if (ret != null)
        return ret;

    final Decls decls = intExpr.decls().accept(delegate);
    final IntExpression expr = intExpr.intExpr().accept(delegate);
    ret = (decls == intExpr.decls() && expr == intExpr.intExpr()) ? intExpr : expr.sum(decls);
    return cache(intExpr, ret);
}
 
Example 3
Source File: AbstractReplacer.java    From kodkod with MIT License 5 votes vote down vote up
/** 
* Calls lookup(intExpr) and returns the cached value, if any.  
* If a replacement has not been cached, visits the expression's 
* children.  If nothing changes, the argument is cached and
* returned, otherwise a replacement expression is cached and returned.
* @return { c: IntExpression | [[c]] = sum intExpr.decls.accept(this) | intExpr.intExpr.accept(this) }
*/
  public IntExpression visit(SumExpression intExpr) {
IntExpression ret = lookup(intExpr);
if (ret!=null) return ret;
	
final Decls decls  = intExpr.decls().accept(this);
final IntExpression expr = intExpr.intExpr().accept(this);
ret =  (decls==intExpr.decls() && expr==intExpr.intExpr()) ? 
		intExpr : expr.sum(decls);
return cache(intExpr,ret);
  }
 
Example 4
Source File: Skolemizer.java    From kodkod with MIT License 5 votes vote down vote up
/**
 * @see kodkod.ast.visitor.AbstractReplacer#visit(kodkod.ast.SumExpression)
 */
@Override
public final IntExpression visit(SumExpression intExpr) {
	IntExpression ret = lookup(intExpr);
	if (ret!=null) return ret;	
	final Environment<Expression> oldRepEnv = repEnv; // skolemDepth < 0 at this point
	final Decls decls  = visit((Decls)intExpr.decls());
	final IntExpression expr = intExpr.intExpr().accept(this);
	ret =  (decls==intExpr.decls() && expr==intExpr.intExpr()) ? intExpr : expr.sum(decls);
	repEnv = oldRepEnv;
	return cache(intExpr,ret);
}