Ejemplo n.º 1
0
  /**
   * sets invisible nodes with visible edges connected to them visible these nodes exist because the
   * setNodesAndEdgesVisible(...) method does not follow data flow ("DF") edges
   *
   * @param graph
   */
  private void setIsolatedNodesVisible(Graph graph) {

    Iterator graphNodes = graph.nodes();
    TableNodeItem node;

    while (graphNodes.hasNext()) {
      node = (TableNodeItem) graphNodes.next();

      if (!node.isVisible()) {
        Iterator incidentEdges = node.edges();
        int visibleEdges = 0;

        while (incidentEdges.hasNext()) {
          TableEdgeItem edge = (TableEdgeItem) incidentEdges.next();
          if (edge.isVisible()) {
            visibleEdges++;
          }
        }
        if (visibleEdges != 0) {
          node.setVisible(true);
          Iterator edges = node.edges();
          while (edges.hasNext()) {
            TableEdgeItem edgeItem = (TableEdgeItem) (edges.next());
            if (!edgeItem.getSourceItem().getString(TYPE).equals(STEP)
                && !edgeItem.getTargetItem().getString(TYPE).equals(STEP)) {
              edgeItem.setVisible(true);
            }
          }
        }
      }
    }
  }
Ejemplo n.º 2
0
  /**
   * sets all nodes and incident edges between startNode and finishNode visible nodes must be
   * connected through control flow ("CF") edge to their parent to be set visible
   *
   * @param startNode
   * @param finishNode
   * @param isFirstNode
   */
  private void setNodesAndEdgesVisible(
      TableNodeItem startNode, TableNodeItem finishNode, boolean isFirstNode) {

    startNode.setVisible(true);
    Iterator startNodeEdges;
    if (isFirstNode) {
      startNodeEdges = startNode.inEdges();
    } else {
      startNodeEdges = startNode.edges();
    }
    while (startNodeEdges.hasNext()) {
      TableEdgeItem startNodeEdge = (TableEdgeItem) startNodeEdges.next();
      if (!startNodeEdge.getString(TYPE).equals(STEP)
          && !(startNodeEdge.getTargetItem()).getString(TYPE).equals(STEP)
          && !(startNodeEdge.getSourceItem()).getString(TYPE).equals(STEP)) {
        startNodeEdge.setVisible(true);
      }
    }

    Iterator<TableNodeItem> startNodeChildren;
    TableNodeItem child;
    if (startNode != finishNode) {
      startNodeChildren = children(startNode);
      while (startNodeChildren.hasNext()) {
        child = startNodeChildren.next();
        if (checkInvisibleFlow(child, startNode) && !(child.isVisible())) {
          setNodesAndEdgesVisible(child, finishNode, false);
        }
      }
    }
  }
Ejemplo n.º 3
0
  /**
   * sets a node of type "Step" and its incident edges invisible
   *
   * @param stepNode
   */
  private void setStepInvisible(TableNodeItem stepNode) {

    stepNode.setVisible(false);
    Iterator stepEdges = stepNode.edges();
    TableEdgeItem stepEdge;

    while (stepEdges.hasNext()) {
      stepEdge = (TableEdgeItem) stepEdges.next();
      stepEdge.setVisible(false);
    }
  }
Ejemplo n.º 4
0
  /**
   * sets nodes with no visible edges connected to them (isolated nodes) invisible these nodes exist
   * because the setNodesAndEdgesInvisible(...) method does not follow data flow ("DF") edges
   *
   * @param graph
   */
  private void setIsolatedNodesInvisible(Graph graph) {

    Iterator graphNodes = graph.nodes();
    TableNodeItem node;
    boolean rootDrawn = false;
    while (graphNodes.hasNext()) {
      node = (TableNodeItem) graphNodes.next();
      if (node.isVisible() && getOutVDegree(node) == 0 && rootDrawn) {
        node.setVisible(false);
        Iterator incidentEdges = node.edges();
        while (incidentEdges.hasNext()) {
          ((TableEdgeItem) incidentEdges.next()).setVisible(false);
        }
      }
      rootDrawn = true;
    }
  }
Ejemplo n.º 5
0
  /**
   * sets all nodes and incident edges between startNode and finishNode invisible nodes must be
   * connected through control flow ("CF") edge or "Step" edge to their parent to be set invisible
   *
   * @param startNode
   * @param finishNode
   */
  private void setNodesAndEdgesInvisible(TableNodeItem startNode, TableNodeItem finishNode) {

    startNode.setVisible(false);
    Iterator startNodeEdges = startNode.edges();
    while (startNodeEdges.hasNext()) {
      TableEdgeItem startNodeEdge = (TableEdgeItem) startNodeEdges.next();
      startNodeEdge.setVisible(false);
    }

    Iterator<TableNodeItem> startNodeChildren;
    TableNodeItem startNodeChild;
    if (startNode != finishNode) {
      startNodeChildren = children(startNode);
      while (startNodeChildren.hasNext()) {
        startNodeChild = startNodeChildren.next();
        if (checkFlow(startNodeChild, startNode) && startNodeChild.isVisible()) {
          setNodesAndEdgesInvisible(startNodeChild, finishNode);
        }
      }
    }
  }
Ejemplo n.º 6
0
  /**
   * sets all "Step" type nodes (and their incident edges) connected to the startNode passed as
   * parameter visible
   *
   * @param startNode
   */
  private void setStepVisible(TableNodeItem startNode) {

    TableNodeItem startNodeParent = getParent(startNode);
    Iterator<TableNodeItem> children = children(startNodeParent);
    TableNodeItem child = null;
    Iterator stepEdges = null;
    TableEdgeItem stepEdge;

    assert children.hasNext();
    while (children.hasNext()) {
      child = children.next();
      if (child.getString(TYPE).equals(STEP)) {
        child.setVisible(true);
        stepEdges = child.edges();
        break;
      }
    }
    while (stepEdges.hasNext()) {
      stepEdge = (TableEdgeItem) stepEdges.next();
      stepEdge.setVisible(true);
    }

    stepId = child.getInt(ID);
  }