Exemplo n.º 1
0
 private void appendExporter(StringBuilder sb, JobPort port) {
   for (NodeElement node : port.getInputNodes()) {
     GenNode gen = nodeMap.get(node);
     sb.append("\t\tthis.");
     sb.append(port.getName());
     sb.append(".add(");
     sb.append(gen.getUseVariableName());
     sb.append(");\n");
   }
 }
Exemplo n.º 2
0
 private void appendField(StringBuilder sb, JobPort port, String inOut) {
   sb.append("\t/** ");
   sb.append(StringUtil.nonNull(port.getDescription()));
   sb.append(" */\n");
   sb.append("\tprivate final ");
   sb.append(inOut);
   sb.append("<");
   sb.append(getCachedClassName(getModelClassName(port)));
   sb.append("> ");
   sb.append(port.getName());
   sb.append(";\n");
 }
Exemplo n.º 3
0
  private void appendDescribe(StringBuilder sb) {
    sb.append("\t@Override\n");
    sb.append("\tpublic void describe() {\n");

    Map<Integer, GenNode> map = new HashMap<Integer, GenNode>();
    for (JobPort port : frame.getInputPorts()) {
      GenImporter gen = new GenImporter(port);
      map.put(port.getId(), gen);
      nodeMap.put(port, gen);
    }

    List<GenOperator> opeList = new ArrayList<GenOperator>();
    for (NodeElement node : diagram.getContents()) {
      if (node instanceof OperatorNode) {
        OperatorNode operator = (OperatorNode) node;
        GenOperator gop = new GenOperator(operator);
        opeList.add(gop);
        getFactoryVariableName(gop.getFactoryName(), gop.isFlowPart());
        nodeMap.put(node, gop);
        for (OpePort port : operator.getPorts()) {
          nodeMap.put(port, new GenPort(port));
        }
      }
    }

    appendDescribeVariable(sb);

    for (int i = 0; ; ) {
      if (opeList.isEmpty()) {
        break;
      }
      if (i >= opeList.size()) {
        i = 0;
      }
      GenOperator node = opeList.get(i);
      if (node.complete(map)) {
        appendNode(sb, node, map);
        map.put(node.getId(), node);
        opeList.remove(node);
      } else {
        i++;
      }
    }

    sb.append("\n");
    for (JobPort port : frame.getOutputPorts()) {
      appendExporter(sb, port);
    }

    sb.append("\t}\n");
  }
Exemplo n.º 4
0
  private void appendConstructorArgument(StringBuilder sb, StringBuilder let, JobPort port) {
    String name = port.getName();
    String modelClassName = getCachedClassName(getModelClassName(port));

    sb.append("\t\t\t");
    appendConstructorArgumentAnnotation(sb, port);
    sb.append(port.isIn() ? "In" : "Out");
    sb.append("<");
    sb.append(modelClassName);
    sb.append("> ");
    sb.append(name);

    let.append("\t\tthis.");
    let.append(name);
    let.append(" = ");
    let.append(name);
    let.append(";\n");
  }
Exemplo n.º 5
0
 @Override
 public String createVariableName() {
   return "this." + port.getName();
 }