Package org.eclipse.imp.pdb.facts

Examples of org.eclipse.imp.pdb.facts.ISetWriter


    for (IValue t : s) {
      ITuple tuple = (ITuple) t;
      IValue key = tuple.get(0);
      IValue value = tuple.get(1);
     
      ISetWriter writer = map.get(key);
      if (writer == null) {
        writer = values.setWriter();
        map.put(key, writer);
      }
      writer.insert(value);
    }
   
    IMapWriter mapWriter = values.mapWriter();
    for (IValue key : map.keySet()) {
      mapWriter.put(key, map.get(key).done());
View Full Code Here


    for (IValue t : s) {
      ITuple tuple = (ITuple) t;
      IValue key = tuple.get(0);
      IValue value = tuple.get(1);
     
      ISetWriter writer = map.get(key);
      if (writer == null) {
        writer = values.setWriter();
        map.put(key, writer);
      }
      writer.insert(value);
    }
   
    IMapWriter mapWriter = values.mapWriter();
    for (IValue key : map.keySet()) {
      mapWriter.put(key, map.get(key).done());
View Full Code Here

    if (n > 0) {
      int i = 0;
      int k = random.nextInt(n);
      IValue pick = null;
      ISetWriter w = values.setWriter();

      for (IValue v : st) {
        if (i == k) {
          pick = v;
        } else {
          w.insert(v);
        }
        i++;
      }
      return values.tuple(pick, w.done());
    }
    throw RuntimeExceptionFactory.emptySet(null, null);
  }
View Full Code Here

    for (IValue v : st) {
      ITuple t = (ITuple) v;
      IValueWrap key = new IValueWrap(t.get(0));
      IValue val = t.get(1);
      ISetWriter wValSet = hm.get(key);
      if(wValSet == null){
        wValSet = values.setWriter();
        hm.put(key, wValSet);
      }
      wValSet.insert(val);
    }
   
    IMapWriter w = values.mapWriter();
    for(IValueWrap v : hm.keySet()){
      w.put(v.getValue(), hm.get(v).done());
View Full Code Here

       * parsing in the IDE
       */
      ModuleEnvironment env = m.equals(getName()) ? this : heap.getModule(m);
     
      if(env != null){
        ISetWriter importWriter = VF.setWriter();
        for(String impname : env.getImports()){
          if(!done.contains(impname)) todo.add(impname);
         
          importWriter.insert(VF.string(impname));
        }
       
        ISetWriter extendWriter = VF.setWriter();
        for(String impname : env.getExtends()){
          if(!done.contains(impname)) todo.add(impname);
         
          extendWriter.insert(VF.string(impname));
        }
       
        ISetWriter defWriter = VF.setWriter();
        for(IValue def : env.productions){
          defWriter.insert(def);
        }
       
        ITuple t = VF.tuple(importWriter.done(), extendWriter.done(), defWriter.done());
        result.put(VF.string(m), t);
      }else if(m.equals(getName())) { // This is the root scope.
        ISetWriter importWriter = VF.setWriter();
        for(String impname : importedModules){
          if(!done.contains(impname)) todo.add(impname);
         
          importWriter.insert(VF.string(impname));
        }
       
        ISetWriter extendWriter = VF.setWriter();
        for(String impname : getExtends()){
          if(!done.contains(impname)) todo.add(impname);
         
          extendWriter.insert(VF.string(impname));
        }
       
        ISetWriter defWriter = VF.setWriter();
        for(IValue def : productions){
          defWriter.insert(def);
        }
       
        ITuple t = VF.tuple(importWriter.done(), extendWriter.done(), defWriter.done());
        result.put(VF.string(m), t);
      }
    }
   
   
View Full Code Here

    return buildAppl(children, production);
   
  }
 
  private static IConstructor buildAmbiguityNode(ArrayList<IConstructor> alternatives){
    ISetWriter ambSublist = VF.setWriter(Factory.Tree);
    for(int i = alternatives.size() - 1; i >= 0; --i){
      ambSublist.insert(alternatives.get(i));
    }
   
    return VF.constructor(Factory.Tree_Amb, ambSublist.done());
  }
View Full Code Here

TOP

Related Classes of org.eclipse.imp.pdb.facts.ISetWriter

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.