Examples of ModelGraph


Examples of org.apache.oodt.cas.workflow.gui.model.ModelGraph

    return false;
  }

  public static void updateGraphModelId(ViewState state, String id,
      String newModelId) {
    ModelGraph graph = find(state.getGraphs(), id);
    if (graph.getParent() != null
        && graph.getParent().getModel().getExcusedSubProcessorIds()
            .contains(graph.getModel().getModelId())) {
      graph.getParent().getModel().getExcusedSubProcessorIds()
          .remove(graph.getModel().getModelId());
      graph.getParent().getModel().getExcusedSubProcessorIds().add(newModelId);
    }
    graph.getModel().setModelId(newModelId);
  }
View Full Code Here

Examples of org.apache.oodt.cas.workflow.gui.model.ModelGraph

    graph.getModel().setModelId(newModelId);
  }

  public static void addChild(List<ModelGraph> graphs, String parentId,
      ModelGraph child) {
    ModelGraph parent = find(graphs, parentId);
    if (parent != null)
      parent.addChild(child);
  }
View Full Code Here

Examples of org.apache.oodt.cas.workflow.gui.model.ModelGraph

          rootGraphs.add(graph);
        }
      }
    }
    for (int i = 0; i < rootGraphs.size(); i++) {
      ModelGraph rootGraph = rootGraphs.get(i);
      for (int j = 0; j < rootGraphs.size(); j++) {
        if (i != j
            && rootGraphs.get(j).recursiveFind(
                rootGraph.getModel().getModelId()) != null) {
          rootGraphs.remove(i--);
          break;
        }
      }
View Full Code Here

Examples of org.apache.oodt.cas.workflow.gui.model.ModelGraph

      ModelGraph graph) {
    for (ModelGraph rootGraph : rootGraphs) {
      if (graph.equals(rootGraph)) {
        return rootGraph;
      } else if (graph.getParent() != null) {
        ModelGraph root = findRoot(rootGraphs, graph.getParent());
        if (root != null)
          return root;
      }
    }
    return null;
View Full Code Here

Examples of org.apache.oodt.cas.workflow.gui.model.ModelGraph

  }

  public static List<ModelGraph> find(List<ModelGraph> graphs, Set<String> ids) {
    Vector<ModelGraph> foundGraphs = new Vector<ModelGraph>();
    for (String id : ids) {
      ModelGraph graph = find(graphs, id);
      if (graph != null)
        foundGraphs.add(graph);
    }
    return foundGraphs;
  }
View Full Code Here

Examples of org.apache.oodt.cas.workflow.gui.model.ModelGraph

    return foundGraphs;
  }

  public static ModelGraph find(List<ModelGraph> graphs, String id) {
    for (ModelGraph graph : graphs) {
      ModelGraph found = graph.recursiveFind(id);
      if (found != null)
        return found;
    }
    return null;
  }
View Full Code Here

Examples of org.apache.oodt.cas.workflow.gui.model.ModelGraph

  public static ModelGraph removeNode(List<ModelGraph> graphs, ModelNode node) {
    for (int i = 0; i < graphs.size(); i++) {
      if (graphs.get(i).getModel().equals(node)) {
        return graphs.remove(i);
      } else {
        ModelGraph graph = removeNode(graphs.get(i), node);
        if (graph != null)
          return graph;
      }
    }
    return null;
View Full Code Here

Examples of org.apache.oodt.cas.workflow.gui.model.ModelGraph

  public static ModelGraph removeNode(ModelGraph graph, ModelNode node) {
    Stack<ModelGraph> stack = new Stack<ModelGraph>();
    stack.add(graph);
    while (!stack.empty()) {
      ModelGraph curGraph = stack.pop();
      if (curGraph.getModel().equals(node)) {
        curGraph.setParent(null);
        return curGraph;
      } else {
        stack.addAll(curGraph.getChildren());
        if (curGraph.getPreConditions() != null)
          stack.add(curGraph.getPreConditions());
        if (curGraph.getPostConditions() != null)
          stack.add(curGraph.getPostConditions());
      }
    }
    return null;
  }
View Full Code Here

Examples of org.apache.oodt.cas.workflow.gui.model.ModelGraph

    Vector<Line> lines = new Vector<Line>();
    if (graph.getChildren().size() > 0) {
      Stack<ModelGraph> stack = new Stack<ModelGraph>();
      stack.add(graph);
      while (!stack.empty()) {
        ModelGraph curGraph = stack.pop();
        if (curGraph.getModel().getExecutionType().equals("sequential")) {
          for (int i = 0; i < curGraph.getChildren().size() - 1; i++)
            lines.add(new Line(curGraph.getChildren().get(i).getModel(),
                curGraph.getChildren().get(i + 1).getModel()));
        }
        stack.addAll(curGraph.getChildren());
      }
    }
    return lines;
  }
View Full Code Here

Examples of org.apache.oodt.cas.workflow.gui.model.ModelGraph

    Vector<Line> lines = new Vector<Line>();
    if (graph.getChildren().size() > 0) {
      Stack<ModelGraph> graphs = new Stack<ModelGraph>();
      graphs.add(graph);
      while (!graphs.empty()) {
        ModelGraph curGraph = graphs.pop();
        if (curGraph.getModel().isParentType()) {

          if (curGraph.getChildren().size() == 0)
            curGraph.addChild(new ModelGraph(createDummyNode()));

          List<Line> relaventLines = getRelaventLines(lines, curGraph
              .getModel().getId());
          for (Line relaventLine : relaventLines) {
            int index = lines.indexOf(relaventLine);
            if (curGraph.getModel().getExecutionType().toLowerCase()
                .equals("sequential")) {
              lines.remove(index);
              if (curGraph.getChildren().size() > 0) {
                if (relaventLine.getFromModel().equals(curGraph.getModel()))
                  lines.add(new Line(curGraph.getChildren()
                      .get(curGraph.getChildren().size() - 1).getModel(),
                      relaventLine.getToModel()));
                else
                  lines.add(new Line(relaventLine.getFromModel(), curGraph
                      .getChildren().get(0).getModel()));
              }
            } else if (curGraph.getModel().getExecutionType().toLowerCase()
                .equals("parallel")) {
              lines.remove(index);
              if (relaventLine.getFromModel().equals(curGraph.getModel()))
                for (ModelGraph child : curGraph.getChildren())
                  lines.add(new Line(child.getModel(), relaventLine
                      .getToModel()));
              else
                for (ModelGraph child : curGraph.getChildren())
                  lines.add(new Line(relaventLine.getFromModel(), child
                      .getModel()));
            }
          }

          if (curGraph.getModel().getExecutionType().toLowerCase()
              .equals("sequential")) {
            for (int i = 0; i < curGraph.getChildren().size(); i++) {
              if (i == curGraph.getChildren().size() - 1)
                lines.add(new Line(curGraph.getChildren().get(i).getModel(),
                    null));
              else
                lines.add(new Line(curGraph.getChildren().get(i).getModel(),
                    curGraph.getChildren().get(i + 1).getModel()));
            }
          } else if (curGraph.getModel().getExecutionType().toLowerCase()
              .equals("parallel")) {
            for (int i = 0; i < curGraph.getChildren().size(); i++)
              lines
                  .add(new Line(curGraph.getChildren().get(i).getModel(), null));
          }
          graphs.addAll(curGraph.getChildren());
        }
      }
    } else {
      lines.add(new Line(graph.getModel(), null));
    }
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.