Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (C) 2015 The Pennsylvania State University and the University of Wisconsin
   * Systems and Internet Infrastructure Security Laboratory
   *
   * Author: Damien Octeau
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 package edu.psu.cse.siis.coal;
 
 import java.util.Set;
 
 
 import soot.Unit;
 import soot.Value;
 
 
Singleton for managing iterations of the IDE analysis.
 
 public class IterationSolver {
   private final Logger logger = LoggerFactory.getLogger(getClass());
 
   private PropagationSolver solver = null;
   private static IterationSolver instance = new IterationSolver();
 
   private static final class LocationIdentifier {
     private final Unit stmt;
     private final Value symbol;
     private final String field;
     private final String type;
     private final String operation;
 
     public LocationIdentifier(Unit stmtValue symbolString fieldString typeString operation) {
       this. = stmt;
       this. = symbol;
       this. = field;
       this. = type;
       this. = operation;
     }
 
     @Override
     public int hashCode() {
       return Objects.hashCode(this.this.this.this.this.);
     }
 
     @Override
     public boolean equals(Object other) {
       if (other instanceof LocationIdentifier) {
         LocationIdentifier locationIdentifier = (LocationIdentifierother;
         return Objects.equal(this.locationIdentifier.stmt)
             && Objects.equal(this.locationIdentifier.symbol)
             && Objects.equal(this.locationIdentifier.field)
             && Objects.equal(this.locationIdentifier.type)
             && Objects.equal(this.locationIdentifier.operation);
       }
       return false;
     }
   }
 
   public static IterationSolver v() {
     return ;
   }

  
Determines if a fixed point has been reached or there are no undetermined values.

Returns:
True if a fixed point has been reached or there are no undetermined values.
 
   public boolean hasFoundFixedPoint() {
   }

  
Initializes the iteration manager before an iteration. This should be called before every iteration.

Parameters:
propagationSolver The solver from the previous iteration, or null if this is the first iteration.
  public synchronized void initialize(PropagationSolver propagationSolver) {
     = propagationSolver;
     = new HashSet<>();
  }

  
Generates a set of field transformers that represent the influence of a referenced value. This is used when the argument of a COAL modifier is a value that is itself modeled with COAL. In this case, once the referenced value is known, we generate field transformers that take all the possible values of the argument into account. The argument may have more than one value, which is why the return type is a set.

Parameters:
stmt The call statement that references another COAL value.
symbol The variable (referenced COAL value) whose value should be determined.
field The field that the transformer should operate on.
type The type of the field.
operation The operation to be performed.
Returns:
The set of field transformers that represent the influence of the referenced value.
      String fieldString typeString operation) {
    synchronized (this) {
      if ( == null) {
        // This is the first iteration, return top.
        .add(new LocationIdentifier(stmtsymbolfieldtypeoperation));
        return Collections.singleton(ArgumentValueManager.v().getTopFieldTransformer(type));
      }
    }
    if (.isDebugEnabled()) {
      .debug("Making transformer for " + symbol + " for " + field + " at \n" + stmt);
    }
    Boolean[] returnedTop = new Boolean[1];
    Set<FieldTransformerresult =
        FieldTransformerUtils.makeTransformersFromReferencedValue(stmtsymbolfieldtype,
            operationreturnedTop);
    if (returnedTop[0]) {
      // This is not the first iteration, but we still got top.
      .info("Found top at " + stmt);
      if (.isDebugEnabled()) {
        .debug("Result contains top field transformer");
      }
      synchronized (this) {
        .add(new LocationIdentifier(stmtsymbolfieldtypeoperation));
      }
    }
    return result;
  }
New to GrepCode? Check out our FAQ X