Package kodkod.ast.visitor

Examples of kodkod.ast.visitor.AbstractDetector


   * @return { r: roots(formula) | some r.*components & descendants.elements }
   */
  @SuppressWarnings("unchecked")
  public static Set<Formula> allRoots(Formula formula, Collection<? extends Node> descendants) {
    final Set<Node> desc = new IdentityHashSet<Node>(descendants);
    final AbstractDetector detector = new AbstractDetector(Collections.EMPTY_SET) {
      protected Boolean lookup(Node n) {
        return desc.contains(n) ? Boolean.TRUE : cache.get(n);
      }
      protected Boolean cache(Node n, boolean val) {
        final Boolean ret = Boolean.valueOf(val);
View Full Code Here


   * integer bounds (i.e. an ExprToIntCast node with SUM operator or an IntToExprCast node or Expression.INTS constant).
   * @return true if this.node contains a child whose meaning depends on
   * integer bounds (i.e. an ExprToIntCast node with SUM operator or an IntToExprCast node or Expression.INTS constant).
   */
  public final boolean usesInts() {
    final AbstractDetector detector = new AbstractDetector(sharedNodes) {
      public Boolean visit(IntToExprCast expr) {
        return cache(expr, Boolean.TRUE);
      }
      public Boolean visit(ExprToIntCast intExpr) {
        if (intExpr.op()==ExprCastOperator.CARDINALITY)
View Full Code Here

   * of this.node iff the descendent contains a quantified formula.
   * @return a Detector that will return TRUE when applied to a descendent
   * of this.node iff the descendent contains a quantified formula.
   */
  public final AbstractDetector quantifiedFormulaDetector() {
    return new AbstractDetector(sharedNodes) {
      public Boolean visit(QuantifiedFormula quantFormula) {
        return cache(quantFormula, true);
      }
    };
  }
View Full Code Here

  private Skolemizer(AnnotatedNode<Formula> annotated, Bounds bounds, Options options) {
    super(annotated.sharedNodes());

    // only cache intermediate computations for expressions with no free variables
    // and formulas with no free variables and no quantified descendents
    final AbstractDetector fvdetect = annotated.freeVariableDetector();
    final AbstractDetector qdetect = annotated.quantifiedFormulaDetector();
    for(Node n: annotated.sharedNodes()) {
      if (!(Boolean)n.accept(fvdetect)) {
        if (!(n instanceof Formula) || !((Boolean)n.accept(qdetect)))
          this.cache.put(n, null);
      }
View Full Code Here

TOP

Related Classes of kodkod.ast.visitor.AbstractDetector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.