Examples of Sig


Examples of edu.mit.csail.sdg.alloy4compiler.ast.Sig

    return result;
  }

  private Expression createParameter(String methodId, String classId) {
    Sig classSig = getSig("Class");
    SafeList<Field> cFields = classSig.getFields();
    Field cIdRelations = getField("id", cFields);
    Field cMethodsRelations = getField("methods", cFields);
   
    Sig methodSig = getSig("Method");
   
    SafeList<Field> mFields = methodSig.getFields();
    Field mIdRelations = getField("id", mFields);
   
    Map<String, List<String>> idRel = getRelations(mIdRelations);
   
    Field mArgRelations = getField("param", mFields);
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4compiler.ast.Sig

    return parameter;
  }

  private Expression createParameter(String methodId) {
    // pegar parametros dos metodo
    Sig methodSig = getSig("Method");
    SafeList<Field> mFields = methodSig.getFields();
    Field mIdRelations = getField("id", mFields);
    Map<String, List<String>> idRel = getRelations(mIdRelations);
    Field mArgRelations = getField("param", mFields);
    Map<String, List<String>> argRel = getRelations(mArgRelations);
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4compiler.ast.Sig

    Map<String, List<String>> fieldsMap = getRelations(fieldsRel);

    List<String> fields = fieldsMap.get(td);

    if (fields != null) {
      Sig fieldSig = getSig("Field");
      SafeList<Field> fFields = fieldSig.getFields();
      Field fIdRelations = getField("id", fFields);
      Map<String, List<String>> idRel = getRelations(fIdRelations);
      Field fTypeRelations = getField("type", fFields);
      Map<String, List<String>> typeRel = getRelations(fTypeRelations);
      Field fVisRelations = getField("acc", fFields);
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4compiler.ast.Sig

      result = ast.newPrimitiveType(PrimitiveType.LONG);
    else if (type.equals("Int__0"))
      result = ast.newPrimitiveType(PrimitiveType.INT);

    else {
      Sig classSig = getSig("Class");
      SafeList<Field> classFields = classSig.getFields();
      Field classIdRelations = getField("id", classFields);
      Map<String, List<String>> classRel = getRelations(classIdRelations);
      List<String> id = classRel.get(type);
      if (id != null) {
        result = ast.newSimpleType(ast.newName(id.get(0)));
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4compiler.ast.Sig

  }

  private List<ImportDeclaration> getImports(String classId) {
    List<ImportDeclaration> result = new ArrayList<ImportDeclaration>();

    Sig cuSig = getSig("Class");
    SafeList<Field> cuFields = cuSig.getFields();
    Field packageRelations = getField("imports", cuFields);
    Map<String, List<String>> r = getRelations(packageRelations);
    List<String> imported = r.get(classId);

    if (imported != null) {
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4compiler.ast.Sig

  }

  private PackageDeclaration getPackage(String classId) {
    PackageDeclaration result = ast.newPackageDeclaration();

    Sig classSig = getSig("Class");
    SafeList<Field> cFields = classSig.getFields();
    Field packageRelations = getField("package", cFields);
    Map<String, List<String>> r = getRelations(packageRelations);

    String packageName = r.get(classId).get(0);
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4compiler.ast.Sig

    return result;
  }

  private Sig getSig(String s) {
    Sig result = null;

    SafeList<Sig> sigs = ans.getAllReachableSigs();

    for (Sig sig : sigs) {
      String sigName = removeCrap(sig.toString());
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4compiler.ast.Sig

      }
    };
  }
 
  protected Sig createSigByName(String name) {
    Sig result = null;
    for (Sig sig : javaMetamodel.getAllReachableSigs()) {
      String label = sig.label.replaceAll("[^/]*/", "");
      if (label.equals(name))
        result = sig;
    }
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4compiler.ast.Sig

  private ConstList<CommandScope> createScopeList() throws ErrorSyntax {

    List<CommandScope> result = new ArrayList<CommandScope>();

    Sig type = createSigByName("Class");
    Sig method = createSigByName("Method");
    Sig methodId = createSigByName("MethodId");
    Sig classId = createSigByName("ClassId");
    Sig package_ = createSigByName("Package");
    Sig body = createSigByName("Body");
    Sig field = createSigByName("Field");
    Sig fieldId = createSigByName("FieldId");

    CommandScope packageScope = new CommandScope(package_,
        isExactMaxPackages, maxPackages);
    result.add(packageScope);
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4compiler.ast.Sig

        return ans;
    }

    /** Parse sig/set. */
    private Sig parseSig(String id, int depth) throws IOException, Err {
        Sig ans = id2sig.get(id);
        if (ans!=null) return ans;
        XMLNode node = nmap.get(id);
        if (node==null) throw new IOException("Unknown SigID "+id+" encountered.");
        if (!node.is("sig")) throw new IOException("ID "+id+" is not a sig.");
        String label   = label(node);
        Attr isAbstract = yes(node,"abstract") ? Attr.ABSTRACT : null;
        Attr isOne      = yes(node,"one")      ? Attr.ONE      : null;
        Attr isLone     = yes(node,"lone")     ? Attr.LONE     : null;
        Attr isSome     = yes(node,"some")     ? Attr.SOME     : null;
        Attr isPrivate  = yes(node,"private"? Attr.PRIVATE  : null;
        Attr isMeta     = yes(node,"meta")     ? Attr.META     : null;
        Attr isEnum     = yes(node,"enum")     ? Attr.ENUM     : null;
        Attr isExact    = yes(node,"exact")    ? Attr.EXACT    : null;
        if (yes(node,"builtin")) {
           if (label.equals(UNIV.label))   { id2sig.put(id, UNIV);   return UNIV;   }
           if (label.equals(SIGINT.label)) { id2sig.put(id, SIGINT); return SIGINT; }
           if (label.equals(SEQIDX.label)) { id2sig.put(id, SEQIDX); return SEQIDX; }
           if (label.equals(STRING.label)) { id2sig.put(id, STRING); return STRING; }
           throw new IOException("Unknown builtin sig: "+label+" (id="+id+")");
        }
        if (depth > nmap.size()) throw new IOException("Sig "+label+" (id="+id+") is in a cyclic inheritance relationship.");
        List<Sig> parents = null;
        TupleSet ts = factory.noneOf(1);
        for(XMLNode sub:node) {
           if (sub.is("atom")) { ts.add(factory.tuple(sub.getAttribute("label"))); continue; }
           if (!sub.is("type")) continue;
           Sig parent = parseSig(sub.getAttribute("ID"), depth+1);
           if (parents==null) parents = new ArrayList<Sig>();
           parents.add(parent);
        }
        if (parents==null) {
           String parentID = node.getAttribute("parentID");
           Sig parent = parseSig(parentID, depth+1);
           if (!(parent instanceof PrimSig)) throw new IOException("Parent of sig "+label+" (id="+id+") must not be a subset sig.");
           for(Expr choice: choices)
              if (choice instanceof PrimSig && parent==((PrimSig)choice).parent && ((Sig)choice).label.equals(label))
                 { ans=(Sig)choice; choices.remove(choice); break; }
           if (ans==null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.