Package lupos.gui.operatorgraph.visualeditor.ruleeditor.guielements

Examples of lupos.gui.operatorgraph.visualeditor.ruleeditor.guielements.AnnotationPanel


          added = true;
          precedingIndex = i;
        }


        AnnotationPanel panel = (AnnotationPanel) precOp.getAnnotationLabel(node);

        switch(panel.getMode()) {
        case ONLY_PRECEDING_AND_SUCCEEDING:
        case ONLY_PRECEDING:
          if(node.getClass() == JumpOverOperator.class) {
            buffer.append(
                spaces + "if(" + testName + " != " + originalNodeName + ") {\n"
            );

            spaces.append("    ");
          }

          buffer.append(
              spaces + "if(_precedingOperators_" + runNumber + "_" + precedingIndex + ".size() != 1) {\n" +
              spaces + "    " + ((runNumber != 1) ? "continue" : "return false") + ";\n" +
              spaces + "}\n"
          );

          if(node.getClass() == JumpOverOperator.class) {
            spaces.delete(spaces.length()-4, spaces.length());

            buffer.append(spaces + "}\n");
          }

          break;

        case ALL_PRECEDING:
          buffer.append(
              "\n" +
              spaces + "this._dim_" + currentDimension + " = -1;\n"
          );

          for(String variable : this.get_variables_for_next_dimension(precOp, true)) {
            VariableContainer vc = this.variableList_left.get(variable);

            buffer.append(vc.initiate_next_dimension(spaces, currentDimension, "_precedingOperators_" + runNumber + "_" + precedingIndex + ".size()", true));
          }

          break;
        }

        buffer.append(
            "\n" +
            spaces + "for(BasicOperator _precOp_" + runNumber + "_" + i + " : _precedingOperators_" + runNumber + "_" + precedingIndex + ") {\n"
        );

        bracesCount++;
        spaces.append("    ");

        switch(panel.getMode()) {
        case ALL_PRECEDING:
          buffer.append(
              spaces + "this._dim_" + currentDimension + " += 1;\n" +
              "\n"
          );
          break;
        }

        if(panel.isActive()) {
          int opID = panel.getOpID();

          if(opID != -1) {
            buffer.append(
                spaces + "if(_precOp_" + runNumber + "_" + i + ".getOperatorIDTuple(" + nodeName + ").getId() != " + opID + ") {\n" +
                spaces + "    continue;\n" +
                spaces + "}\n" +
                "\n"
            );
          }
        }

        String nextOpName = "_precOp_" + runNumber + "_" + i;
        testName = "";

        switch(panel.getMode()) {
        default:
        case EXISTS:
          if(precOp.getClass() == JumpOverOperator.class) {
            String[] data = this.handleJumpOverOperator(spaces, buffer, (JumpOverOperator) precOp, nextOpName, runNumber, 0, true);
            nextOpName = data[0];
            testName = data[1];
          }

          bracesCount += this.manage_node(spaces, buffer, precOp, nextOpName, visitedNodes, visitedConnections, runNumber, currentDimension, testName);

          break;
        case ALL_PRECEDING:
          buffer.append(
              spaces + "if(!this._checkPrivate" + this.count_private + "(" + nextOpName + ")) {\n" +
              spaces + "    return false;\n" +
              spaces + "}\n"
          );

          this.generate_checkPrivate(precOp, visitedNodes, visitedConnections, currentDimension+1);

          spaces.delete(spaces.length()-4, spaces.length());

          buffer.append(spaces + "}\n");
          bracesCount -= 1;

          break;
        case ALL_SUCCEEDING:
          System.err.println("WARNING: This case should never happen!");

          break;
        case ONLY_PRECEDING_AND_SUCCEEDING:
        case ONLY_SUCCEEDING:
          buffer.append(
              spaces + "if(" + nextOpName + ".getSucceedingOperators().size() != 1) {\n" +
              spaces + "    break;\n" +
              spaces + "}\n" +
              "\n"
          );

          if(precOp.getClass() == JumpOverOperator.class) {
            String[] data = this.handleJumpOverOperator(spaces, buffer, (JumpOverOperator) precOp, nextOpName, runNumber, 0, true);
            nextOpName = data[0];
            testName = data[1];
          }

          bracesCount += this.manage_node(spaces, buffer, precOp, nextOpName, visitedNodes, visitedConnections, runNumber, currentDimension, testName);

          break;
        }
      }
    }


    LinkedList<OperatorIDTuple<Operator>> succedingOperators = node.getSucceedingOperators();

    if(succedingOperators.size() > 0) {
      boolean added = false;
      int succedingIndex = 0;

      for(int i = 0; i < succedingOperators.size(); i += 1) {
        OperatorIDTuple<Operator> sucOpIDTup = succedingOperators.get(i);
        AbstractRuleOperator sucOp = (AbstractRuleOperator) sucOpIDTup.getOperator();


        HashSet<Operator> connectionNodes = visitedConnections.get(node);

        if(connectionNodes == null) {
          connectionNodes = new HashSet<Operator>();
          visitedConnections.put(node, connectionNodes);
        }
        else if(connectionNodes.contains(sucOp)) {
          continue;
        }

        connectionNodes.add(sucOp);


        if(!added) {
          buffer.append(
              "\n" +
              spaces + "List<OperatorIDTuple> _succedingOperators_" + runNumber + "_" + i + " = " + nodeName + ".getSucceedingOperators();\n" +
              "\n"
          );

          added = true;
          succedingIndex = i;
        }


        AnnotationPanel panel = (AnnotationPanel) node.getAnnotationLabel(sucOp);

        switch(panel.getMode()) {
        case ONLY_PRECEDING_AND_SUCCEEDING:
        case ONLY_SUCCEEDING:
          buffer.append(
              spaces + "if(_succedingOperators_" + runNumber + "_" + succedingIndex + ".size() != 1) {\n" +
              spaces + "    " + ((runNumber != 1) ? "continue" : "return false") + ";\n" +
              spaces + "}\n"
          );

          break;


        case ALL_SUCCEEDING:
          buffer.append(
              "\n" +
              spaces + "this._dim_" + currentDimension + " = -1;\n"
          );

          for(String variable : this.get_variables_for_next_dimension(sucOp, false)) {
            VariableContainer vc = this.variableList_left.get(variable);

            buffer.append(vc.initiate_next_dimension(spaces, currentDimension, "_succedingOperators_" + runNumber + "_" + succedingIndex + ".size()", true));
          }

          break;
        }


        buffer.append(
            "\n" +
            spaces + "for(OperatorIDTuple _sucOpIDTup_" + runNumber + "_" + i + " : _succedingOperators_" + runNumber + "_" + succedingIndex + ") {\n"
        );

        bracesCount++;
        spaces.append("    ");

        switch(panel.getMode()) {
        case ALL_SUCCEEDING:
          buffer.append(
              spaces + "this._dim_" + currentDimension + " += 1;\n" +
              "\n"
          );
          break;
        }


        if(panel.isActive()) {
          int opID = panel.getOpID();

          if(opID != -1) {
            buffer.append(
                spaces + "if(_sucOpIDTup_" + runNumber + "_" + i + ".getId() != " + opID + ") {\n" +
                spaces + "    continue;\n" +
                spaces + "}\n" +
                "\n"
            );
          }
        }

        String nextOpName = "_sucOpIDTup_" + runNumber + "_" + i + ".getOperator()";
        testName = "";

        switch(panel.getMode()) {
        default:
        case EXISTS:
          if(sucOp.getClass() == JumpOverOperator.class) {
            String[] data = this.handleJumpOverOperator(spaces, buffer, (JumpOverOperator) sucOp, nextOpName, runNumber, 0, false);
            nextOpName = data[0];
View Full Code Here


    // walk through children of this RDFTerm...
    for(OperatorIDTuple<Operator> opIDTuple : this.getSucceedingOperators()) {
      AbstractRuleOperator child = (AbstractRuleOperator) opIDTuple.getOperator(); // get current children

      // create predicate panel...
      AnnotationPanel annotationPanel = new AnnotationPanel(parent, this, child, this.annotations.get(child));

      this.annotationLabels.put(child, annotationPanel);

      // add predicate panel to hash table with its GraphWrapper...
      predicates.put(new GraphWrapperOperator(child), annotationPanel);
View Full Code Here

    // --- handle connections - begin ---
    JSONArray connectionsArray = new JSONArray();

    for(Operator child : this.annotationLabels.keySet()) {
      AbstractRuleOperator childOp = (AbstractRuleOperator) child;
      AnnotationPanel ap = (AnnotationPanel) this.annotationLabels.get(child);

      JSONObject childConnectionObject = new JSONObject();
      childConnectionObject.put("to", childOp.getName());
      childConnectionObject.put("active", ap.isActive());
      childConnectionObject.put("id", ap.getOpID());
      childConnectionObject.put("id label", ap.getOpLabel());
      childConnectionObject.put("mode", ap.getMode().name());

      connectionsArray.put(childConnectionObject);
    }

    if(connectionsArray.length() > 0) {
View Full Code Here

TOP

Related Classes of lupos.gui.operatorgraph.visualeditor.ruleeditor.guielements.AnnotationPanel

Copyright © 2018 www.massapicom. 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.