Exemplo n.º 1
0
 public GenOperator(OperatorNode node) {
   super(node);
   this.node = node;
   for (OpePort port : node.getInputPorts()) {
     NodeElement cnode = port.getConnectedNode();
     if (cnode != null) {
       incomings.add(cnode);
     }
   }
 }
Exemplo n.º 2
0
    public void appendArgsTo(StringBuilder sb) {
      List<String> args = new ArrayList<String>();
      for (OpePort port : node.getInputPorts()) {
        NodeElement cnode = port.getConnectedNode();
        GenNode gen = nodeMap.get(cnode);
        String varName = (gen != null) ? gen.getUseVariableName() : "null";
        args.add(varName);
      }
      for (Connection c : node.getIncomings()) {
        NodeElement cnode = c.getOpposite(node);
        GenNode gen = nodeMap.get(cnode);
        String varName = (gen != null) ? gen.getUseVariableName() : "null";
        args.add(varName);
      }
      for (OpeParameter param : node.getParameterList()) {
        args.add(getQualifiedValue(param.getClassName(), param.getValue()));
      }
      String nodeType = node.getType();
      if ("restructure".equals(nodeType)
          || "extend".equals(nodeType)
          || "project".equals(nodeType)) {
        OpePort port = node.getOutputPort();
        String modelClass = getModelClassName(port);
        args.add(getQualifiedValue("java.lang.Class", modelClass));
      } else if ("empty".equals(nodeType)) {
        String modelClass = findModelClass(node);
        args.add(getQualifiedValue("java.lang.Class", modelClass));
      }

      if ("confluent".equals(nodeType)) {
        switch (args.size()) {
          case 2:
          case 3:
          case 4:
            break;
          default:
            sb.append(getCachedClassName("java.util.Arrays"));
            sb.append(".asList(");
            StringUtil.mkString(sb, args);
            sb.append(")");
            return;
        }
      }
      StringUtil.mkString(sb, args);
    }