예제 #1
0
파일: GraphImpl.java 프로젝트: teropa/stem
  /**
   *
   * <!-- begin-user-doc -->
   * This method adds the {@link Edge}s, {@link Node}s, {@link Label}s and {@link Decorator} from
   * another graph to the collections maintained by this graph.
   *
   * <p>It does not attempt to resolve connections between Edges and the Nodes they reference.
   * <!-- end-user-doc -->
   *
   * @generated NOT
   */
  public void addGraph(final Graph graph, IdentifiableFilter filter) {
    IdentifiableFilterImpl _filter = (IdentifiableFilterImpl) filter;
    EMap<URI, Edge> edges = graph.getEdges();
    EMap<URI, Node> nodes = graph.getNodes();
    EMap<URI, NodeLabel> nodeLabels = graph.getNodeLabels();
    EMap<URI, Label> graphLabels = graph.getGraphLabels();

    if (filter != null) {
      _filter.filterEdges(edges);
      _filter.filterNodes(nodes);
      _filter.filterNodeLabels(nodeLabels);
      _filter.filterLabels(graphLabels);
    }

    getEdges().addAll(edges);
    getNodes().addAll(nodes);
    getNodeLabels().addAll(nodeLabels);
    getDecorators().addAll(graph.getDecorators());

    // We need to update the graph labels to the new graph
    for (final Iterator<Label> graphLabelIter = graphLabels.values().iterator();
        graphLabelIter.hasNext(); ) {
      final Label graphLabel = graphLabelIter.next();
      graphLabel.setURIOfIdentifiableToBeLabeled(getURI());
      putGraphLabel(graphLabel);
    } // for each new graph label

    getDynamicLabels().addAll(graph.getDynamicLabels());
    getUnresolvedIdentifiables().addAll(graph.getUnresolvedIdentifiables());
  } // addGraph
예제 #2
0
파일: GraphImpl.java 프로젝트: teropa/stem
 /**
  * @see org.eclipse.stem.common.impl.IdentifiableImpl#setURI(org.eclipse.emf.common.util.URI)
  * @generated NOT
  */
 @Override
 public void setURI(URI newURI) {
   super.setURI(newURI);
   // Now go through all the graph labels and update then to reference the
   // new URI
   for (final Iterator<Label> labelIter = getGraphLabels().values().iterator();
       labelIter.hasNext(); ) {
     final Label label = labelIter.next();
     label.setURIOfIdentifiableToBeLabeled(newURI);
   } // for
 } // setURI