Package dk.brics.automaton

Examples of dk.brics.automaton.Automaton


            parameterAutomatonMapFull.get(m2).put(paramIndex, m2Parameter);
        }
    }
   
    private void inheritReturnType(SootMethod m1, Automaton m1Returns, SootMethod m2) {
        Automaton m2Returns = returnAutomatonMap.get(m2);
       
        // if subtype has no annotation, inherit this one
        if (m2Returns == null) {
            Automaton m2full = returnAutomatonMapFull.get(m2);
            if (m2full == null) {
                returnAutomatonMapFull.put(m2, m1Returns);
            } else {
                // if inheriting for more than one place, intersect the languages
                returnAutomatonMapFull.put(m2, m1Returns.intersection(m2full));
View Full Code Here


    Automaton result = node.process(proc);
    return result;
  }
  final public Automaton apply(XMLGraph g) {
    graph = g;
    Automaton result = Automaton.makeEmpty();
    for (int root : g.getRoots()) {
      Node node = g.getNode(root);
      Automaton c = node.process(proc);
      result = result.union(c);
    }
    return result;
  }
View Full Code Here

        String type = at.getType().trim();
        if (type.equals("Ldk/brics/string/annotation/Type;") && at.getNumElems() == 1) {
            // XXX why are we trimming the regexp here?? Although rare, it is perfectly sane for a string-type
            // to end with blanks. E.g @Type("Hello ") would become @Type("Hello").
          String pattern = ((AnnotationStringElem)at.getElemAt(0)).getValue().trim();
          Automaton a = (new RegExp(pattern)).toAutomaton(bindings);
          automatonDescriptionMap.put(a, pattern);
          return a;
        }
        if (type.equals("Ldk/brics/string/annotation/LoadType;") && at.getNumElems() == 1) {
          String path = ((AnnotationStringElem)at.getElemAt(0)).getValue().trim();
          Automaton a = loadAutomaton(path);
          if (a != null) {
            automatonDescriptionMap.put(a, "automaton '" + path + "'");
            return a;
          }
          else {
View Full Code Here

 
  private Automaton loadAutomaton(String path) {
    try {
      //Try to load automaton
      ObjectInputStream in = new ObjectInputStream(new FileInputStream(path));
      Automaton a = (Automaton) in.readObject();
      return a;
    }
    catch (Exception e) {
      //Load failed.
      String error = "Loading automaton '" + path + "' failed!";
View Full Code Here

      Value value = expr.getArg(i);
      ValueBox box = expr.getArgBox(i);
      if (isStringType(value.getType())) {
        Map<Integer,Automaton> pMap = parameterAutomatonMap.get(target);
        if (pMap != null && pMap.containsKey(i)) {
          Automaton automaton = pMap.get(i);
          createHotspot(stmt, box, automaton);
        }
      }
    }
  }
View Full Code Here

    ValueBox rbox = stmt.getRightOpBox();
    if (lvalue instanceof JInstanceFieldRef) {
      JInstanceFieldRef ref = (JInstanceFieldRef)lvalue;
      SootField field = ref.getField();
      if (fieldAutomatonMap.containsKey(field)) {
        Automaton automaton = fieldAutomatonMap.get(field);
        createHotspot(stmt, rbox, automaton);
      }
    }
  }
View Full Code Here

    if (rvalue instanceof ParameterRef) {
      ParameterRef parameter = (ParameterRef)rvalue;
      int index = parameter.getIndex();
      Map<Integer,Automaton> pMap = parameterAutomatonMap.get(currentMethod);
      if (pMap != null && pMap.containsKey(index)) {
        Automaton automaton = pMap.get(index);
        createHotspot(stmt, rbox, automaton);
      }
    }
  }
View Full Code Here

 
  @Override
  public void caseReturnStmt(ReturnStmt stmt) {
    if (returnAutomatonMap.containsKey(currentMethod)) {
      ValueBox box = stmt.getOpBox();
      Automaton automaton = returnAutomatonMap.get(currentMethod);
      createHotspot(stmt, box, automaton);
    }
  }
View Full Code Here

    private Automaton choiceOrInterleave(MultiContentNode n) {
      List<Automaton> autos = new ArrayList<Automaton>();
      for (int child : n.getContents()) {
        autos.add(graph.getNode(child).process(this));
      }
      Automaton result = Automaton.union(autos);
      if (n instanceof InterleaveNode)
        result = result.repeat(1);
      return result;
    }
View Full Code Here

    public Automaton process(SequenceNode n) {
      List<Automaton> autos = new ArrayList<Automaton>();
      for (int child : n.getContents()) {
        autos.add(graph.getNode(child).process(this));
      }
      Automaton result = Automaton.concatenate(autos);
      return result;
    }
View Full Code Here

TOP

Related Classes of dk.brics.automaton.Automaton

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.