Example #1
0
  private PortPeek createPortPeek(Action action, Element element) {
    PortPeek portPeek = IrFactory.eINSTANCE.createPortPeek();
    portPeek.setId(element.getAttribute("id"));
    doAnnotations(portPeek, element);
    portPeek.setPort(findPort((Actor) action.getOuter(), element.getAttribute("port"), false));
    portPeek.setPosition(Integer.parseInt(element.getAttribute("position")));
    Element repeat = getChild(element, "Repeat");
    if (repeat != null) {
      portPeek.setRepeat(createExpression(getChild(repeat, "Expr")));
    }

    portPeek.setVariable(createVariableReference(getChild(element, "Var")));

    return portPeek;
  }
Example #2
0
  private PortRead createPortRead(Action action, Element element) {
    PortRead portRead = IrFactory.eINSTANCE.createPortRead();
    portRead.setId(element.getAttribute("id"));
    doAnnotations(portRead, element);
    portRead.setPort(findPort((Actor) action.getOuter(), element.getAttribute("port"), false));

    List<Element> vars = getChildren(element, "Var");
    for (Element e : vars) {
      VariableReference var = createVariableReference(e);
      portRead.getVariables().add(var);
    }

    Element repeat = getChild(element, "Repeat");
    if (repeat != null) {
      portRead.setRepeat(createExpression(getChild(repeat, "Expr")));
    }

    return portRead;
  }
Example #3
0
  private PortWrite createPortWrite(Action action, Element element) {
    PortWrite portWrite = IrFactory.eINSTANCE.createPortWrite();
    String id = element.getAttribute("id");
    portWrite.setId(id);
    doAnnotations(portWrite, element);
    addIrObject(id, portWrite);

    portWrite.setOuter(action);

    portWrite.setPort(findPort((Actor) action.getOuter(), element.getAttribute("port"), true));

    List<Element> decls = getChildren(element, "Decl");
    for (Element e : decls) {
      Declaration decl = createDeclaration(e);
      portWrite.getDeclarations().add(decl);
    }

    List<Element> stmts = getChildren(element, "Stmt");
    for (Element e : stmts) {
      Statement stmt = createStatement(e);
      portWrite.getStatements().add(stmt);
    }

    List<Element> exprs = getChildren(element, "Expr");
    for (Element e : exprs) {
      Expression expr = createExpression(e);
      portWrite.getExpressions().add(expr);
    }

    Element repeat = getChild(element, "Repeat");
    if (repeat != null) {
      portWrite.setRepeat(createExpression(getChild(repeat, "Expr")));
    }

    return portWrite;
  }