Examples of CompositeNode


Examples of com.impossibl.postgres.jdbc.SQLTextTree.CompositeNode

    if (nodes.size() == 0) {
      return Collections.emptyList();
    }

    CompositeNode current = new CompositeNode(startPos);

    List<Node> comps = new ArrayList<>();

    Iterator<Node> nodeIter = nodes.iterator();
    while (nodeIter.hasNext()) {

      Node node = nodeIter.next();

      if (node instanceof PieceNode && matchList.contains(((PieceNode) node).getText().toUpperCase())) {

        current.trim();

        if (current.getNodeCount() > 0) {

          comps.add(current);
          current = new CompositeNode(node.getEndPos());

        }

        if (includeMatches) {
          comps.add(node);
        }

      }
      else {

        current.add(node);
      }

    }

    current.trim();

    if (current.getNodeCount() > 0) {
      comps.add(current);
    }

    return comps;
  }
View Full Code Here

Examples of com.impossibl.postgres.jdbc.SQLTextTree.CompositeNode

    return groupNode;
  }

  static CompositeNode sequence(String identName, Object... args) {

    CompositeNode seqNode = new CompositeNode(-1);

    seqNode.add(ident(identName));
    sequence(seqNode, asList(args));

    return seqNode;
  }
View Full Code Here

Examples of com.impossibl.postgres.jdbc.SQLTextTree.CompositeNode

    return seqNode;
  }

  static CompositeNode sequence(Object... args) {

    CompositeNode seqNode = new CompositeNode(-1);

    sequence(seqNode, asList(args));

    return seqNode;
  }
View Full Code Here

Examples of com.impossibl.postgres.jdbc.SQLTextTree.CompositeNode

  }

  static Node concat(Node a, Node b) {

    if (a instanceof CompositeNode) {
      CompositeNode ac = (CompositeNode) a;
      if (b instanceof CompositeNode)
        ac.nodes.addAll(((CompositeNode) b).nodes);
      else
        ac.nodes.add(b);
      return a;
    }
    else if (b instanceof CompositeNode) {
      ((CompositeNode) b).nodes.add(0, a);
      return b;
    }
    else {
      CompositeNode c = new CompositeNode(-1);
      c.add(a);
      c.add(b);
      return c;
    }
  }
View Full Code Here

Examples of com.impossibl.postgres.jdbc.SQLTextTree.CompositeNode

              break;
            }
          case ';':
            if (parents.size() == 2) {
              paramId = 1;
              CompositeNode comp = parents.pop();
              comp.setEndPos(ndx);
              parents.peek().add(comp);
              parents.push(new StatementNode(ndx));
            }
            else {
              parents.peek().add(new GrammarPiece(";", ndx));
            }
            break;
          default:
            if (Character.isWhitespace(c)) {
              WhitespacePiece whitespacePiece = new WhitespacePiece(sql.substring(ndx, ndx + 1), ndx);
              if (parents.peek().getLastNode() instanceof WhitespacePiece) {
                ((WhitespacePiece) parents.peek().getLastNode()).coalesce(whitespacePiece);
              }
              else {
                parents.peek().add(whitespacePiece);
              }
            }
            else if (Character.isDigit(c) || (c == '+' && Character.isDigit(lookAhead(sql, ndx)))) {
              ndx = consumeNumeric(sql, ndx, parents.peek());
              continue;
            }
            else if (Character.isJavaIdentifierStart(c)) {
              ndx = consumeUnquotedIdentifier(sql, ndx, parents.peek());
              continue;
            }
            else {
              GrammarPiece grammarPiece = new GrammarPiece(sql.substring(ndx, ndx + 1), ndx);
              if (parents.peek().getLastNode() instanceof GrammarPiece) {
                ((GrammarPiece) parents.peek().getLastNode()).coalesce(grammarPiece);
              }
              else {
                parents.peek().add(grammarPiece);
              }
            }
        }

        ++ndx;
      }

      // Auto close last statement
      if (parents.peek() instanceof StatementNode) {

        StatementNode stmt = (StatementNode) parents.peek();

        stmt.trim();

        if (stmt.getNodeCount() > 0) {
          CompositeNode tmp = parents.pop();
          tmp.setEndPos(ndx);
          parents.peek().add(tmp);
        }
      }

      if (parents.peek() instanceof StatementNode == false && parents.peek() instanceof MultiStatementNode == false) {
View Full Code Here

Examples of diva.graph.modular.CompositeNode

        //        A
        //       / \
        //      B   C
        //
        BasicGraphModel model = new BasicGraphModel();
        CompositeNode root = (CompositeNode) model.getRoot();
        Node a = model.createNode("a");
        Node b = model.createNode("b");
        Node c = model.createNode("c");
        model.addNode(this, a, root);
        model.addNode(this, b, root);
View Full Code Here

Examples of diva.graph.modular.CompositeNode

        //      B   C
        //
        BasicGraphModel model = new BasicGraphModel();
        Node a = model.createNode("a");
        Node b = model.createNode("b");
        CompositeNode c = model.createComposite("c");
        CompositeNode c2 = model.createComposite("c2");
        Node d = model.createNode("d");
        Node d2 = model.createNode("d2");
        model.addNode(this, a, model.getRoot());
        model.addNode(this, c, model.getRoot());
        model.addNode(this, b, model.getRoot());
View Full Code Here

Examples of org.drools.workflow.core.node.CompositeNode

        StartNode startNode = new StartNode();
        startNode.setName("Start");
        startNode.setId(1);
        process.addNode(startNode);
       
        CompositeNode compositeNode = new CompositeNode();
        compositeNode.setName("CompositeNode");
        compositeNode.setId(2);
        process.addNode(compositeNode);
        new ConnectionImpl(
            startNode, Node.CONNECTION_DEFAULT_TYPE,
            compositeNode, Node.CONNECTION_DEFAULT_TYPE
        );
       
        MilestoneNode milestoneNode = new MilestoneNode();
        milestoneNode.setName("Milestone");
        milestoneNode.setConstraint("eval(false)");
        compositeNode.addNode(milestoneNode);
        compositeNode.linkIncomingConnections(Node.CONNECTION_DEFAULT_TYPE, milestoneNode.getId(), Node.CONNECTION_DEFAULT_TYPE);
       
        EventNode eventNode = new EventNode();
        EventTypeFilter eventFilter = new EventTypeFilter();
        eventFilter.setType("myEvent");
        eventNode.addEventFilter(eventFilter);
        eventNode.setVariableName("event");
        compositeNode.addNode(eventNode);
       
        final List<String> myList = new ArrayList<String>();
        ActionNode actionNode = new ActionNode();
        actionNode.setName("Print");
        DroolsAction action = new DroolsConsequenceAction("java", null);
        action.setMetaData("Action", new Action() {
            public void execute(KnowledgeHelper knowledgeHelper, WorkingMemory workingMemory, ProcessContext context) throws Exception {
              System.out.println("Detected event for person " + ((Person) context.getVariable("event")).getName());
                myList.add("Executed action");
            }
        });
        actionNode.setAction(action);
        compositeNode.addNode(actionNode);
        new ConnectionImpl(
            eventNode, Node.CONNECTION_DEFAULT_TYPE,
            actionNode, Node.CONNECTION_DEFAULT_TYPE
        );
       
        Join join = new Join();
        join.setName("XOR Join");
        join.setType(Join.TYPE_XOR);
        compositeNode.addNode(join);
        new ConnectionImpl(
            milestoneNode, Node.CONNECTION_DEFAULT_TYPE,
            join, Node.CONNECTION_DEFAULT_TYPE
        );
        new ConnectionImpl(
            actionNode, Node.CONNECTION_DEFAULT_TYPE,
            join, Node.CONNECTION_DEFAULT_TYPE
        );
        compositeNode.linkOutgoingConnections(join.getId(), Node.CONNECTION_DEFAULT_TYPE, Node.CONNECTION_DEFAULT_TYPE);
   
        EndNode endNode = new EndNode();
        endNode.setName("EndNode");
        endNode.setId(3);
        process.addNode(endNode);
View Full Code Here

Examples of org.drools.workflow.core.node.CompositeNode

                    errors.add(new ProcessValidationErrorImpl(process,
                        "ForEach node '" + node.getName() + "' [" + node.getId() + "] has no linked end node"));
                }
                validateNodes(forEachNode.getNodes(), errors, process);
            } else if (node instanceof CompositeNode) {
                final CompositeNode compositeNode = (CompositeNode) node;
                for (Map.Entry<String, NodeAndType> inType: compositeNode.getLinkedIncomingNodes().entrySet()) {
                    if (compositeNode.getIncomingConnections(inType.getKey()).size() == 0) {
                        errors.add(new ProcessValidationErrorImpl(process,
                            "Composite node '" + node.getName() + "' [" + node.getId() + "] has no incoming connection for type " + inType.getKey()));
                    }
                  if (inType.getValue().getNode() == null) {
                        errors.add(new ProcessValidationErrorImpl(process,
                            "Composite node '" + node.getName() + "' [" + node.getId() + "] has invalid linked incoming node for type " + inType.getKey()));
                  }
                }
                for (Map.Entry<String, NodeAndType> outType: compositeNode.getLinkedOutgoingNodes().entrySet()) {
                    if (compositeNode.getOutgoingConnections(outType.getKey()).size() == 0) {
                        errors.add(new ProcessValidationErrorImpl(process,
                            "Composite node '" + node.getName() + "' [" + node.getId() + "] has no outgoing connection for type " + outType.getKey()));
                    }
                  if (outType.getValue().getNode() == null) {
                        errors.add(new ProcessValidationErrorImpl(process,
                            "Composite node '" + node.getName() + "' [" + node.getId() + "] has invalid linked outgoing node for type " + outType.getKey()));
                  }
                }
                validateNodes(compositeNode.getNodes(), errors, process);
            } else if (node instanceof EventNode) {
                final EventNode eventNode = (EventNode) node;
                if (eventNode.getEventFilters().size() == 0) {
                    errors.add(new ProcessValidationErrorImpl(process,
                        "Event node '" + node.getName() + "' [" + node.getId() + "] should specify an event type"));
View Full Code Here

Examples of org.drools.workflow.core.node.CompositeNode

      return "composite";
    }

    public void writeNode(Node node, StringBuilder xmlDump, boolean includeMeta) {
      super.writeNode(getNodeName(), node, xmlDump, includeMeta);
        CompositeNode compositeNode = (CompositeNode) node;
        writeAttributes(compositeNode, xmlDump, includeMeta);
        xmlDump.append(">" + EOL);
      for (String eventType: compositeNode.getActionTypes()) {
          writeActions(eventType, compositeNode.getActions(eventType), xmlDump);
        }
        writeTimers(compositeNode.getTimers(), xmlDump);
        if (compositeNode instanceof CompositeContextNode) {
          VariableScope variableScope = (VariableScope)
        ((CompositeContextNode) compositeNode).getDefaultContext(VariableScope.VARIABLE_SCOPE);
          if (variableScope != null) {
            List<Variable> variables = variableScope.getVariables();
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.