Package com.google.devtools.depan.model

Examples of com.google.devtools.depan.model.GraphEdge


  @Override
  public void newDep(GraphNode parent, GraphNode child, Relation t) {
    GraphNode p = graphBuilder.mapNode(parent);
    GraphNode c = graphBuilder.mapNode(child);

    graphBuilder.addEdge(new GraphEdge(p, c, t));
  }
View Full Code Here


        if (GraphNode.class.isAssignableFrom(childClass)) {
          GraphNode node = (GraphNode) context.convertAnother(null, childClass);
          result.addNode(node);
        }
        else if (GraphEdge.class.isAssignableFrom(childClass)) {
          GraphEdge edge =
              (GraphEdge) context.convertAnother(null, childClass);
          result.addEdge(edge);
        } else {
          logger.info("Skipped object with tag " + childName);
        }
View Full Code Here

    // edges
    GraphEdge[] edges = new GraphEdge[0];
    edges = viewGraph.getEdges().toArray(edges);
    edgesProperties = new EdgeRenderingProperty[edges.length];
    for (int i = 0; i < edges.length; ++i) {
      GraphEdge edge = edges[i];
      GraphNode n1 = edge.getHead();
      GraphNode n2 = edge.getTail();
      NodeRenderingProperty p1 = nodePropMap.get(n1);
      NodeRenderingProperty p2 = nodePropMap.get(n2);
      if (p1 == null || p2 == null) {
        continue;
      }
View Full Code Here

  }

  @Override
  public void marshal(Object source, HierarchicalStreamWriter writer,
      MarshallingContext context) {
    GraphEdge edge = (GraphEdge) source;

    Relation relation = edge.getRelation();
    writer.startNode(RELATION_TAG);

    Class<?> actualType = relation.getClass();
    Class<?> defaultType = mapper.defaultImplementationOf(BasicEdge.class);
    if (!actualType.equals(defaultType)) {
        writer.addAttribute(
            mapper.aliasForAttribute("class"),
            mapper.serializedClass(actualType));
    }

    context.convertAnother(relation);
    writer.endNode();

    writer.startNode(HEAD_TAG);
    context.convertAnother(edge.getHead().getId());
    writer.endNode();

    writer.startNode(TAIL_TAG);
    context.convertAnother(edge.getTail().getId());
    writer.endNode();
  }
View Full Code Here

      reader.moveDown();
      GraphNode tail = unmarshallGraphNode(reader, context, graph);
      reader.moveUp();

      GraphEdge result = (GraphEdge) graph.findEdge(relation, head, tail);
      return result;
    } catch (RuntimeException err) {
      // TODO(leeca): Add some error diagnostics, or eliminate as dead code.
      throw err;
    }
View Full Code Here

  }

  @Override
  public void marshal(Object source, HierarchicalStreamWriter writer,
      MarshallingContext context) {
    GraphEdge edge = (GraphEdge) source;

    Relation relation = edge.getRelation();
    writer.startNode(RELATION_TAG);

    Class<?> actualType = relation.getClass();
    Class<?> defaultType = mapper.defaultImplementationOf(BasicEdge.class);
    if (!actualType.equals(defaultType)) {
        writer.addAttribute(
            mapper.aliasForAttribute("class"),
            mapper.serializedClass(actualType));
    }

    context.convertAnother(relation);
    writer.endNode();

    writer.startNode(HEAD_TAG);
    context.convertAnother(edge.getHead().getId());
    writer.endNode();

    writer.startNode(TAIL_TAG);
    context.convertAnother(edge.getTail().getId());
    writer.endNode();
  }
View Full Code Here

      reader.moveDown();
      GraphNode tail = unmarshallGraphNode(reader, context, graph);
      reader.moveUp();

      GraphEdge result = new GraphEdge(head, tail, relation);
      return result;
    } catch (RuntimeException err) {
      // TODO Auto-generated catch block
      err.printStackTrace();
      throw err;
View Full Code Here

  private void addSyntheticEdge(
      Collection<GraphEdge> result,
      GraphEdge original,
      GraphNode head,
      GraphNode tail) {
    result.add(new GraphEdge(head, tail, original.getRelation()));
  }
View Full Code Here

    }

    @Override
    protected void insertEdge(
        GraphNode parentNode, GraphNode childNode, PathInfo childInfo) {
      GraphEdge treeEdge = new GraphEdge(
        builder.mapNode(parentNode), builder.mapNode(childNode),
        childInfo.getToRelation());
      builder.addEdge(treeEdge);
    }
View Full Code Here

    Map<GraphEdge, EdgeDisplayProperty> newEdgeProperties =
        Maps.newHashMap();
    Set<Relation> newRelations = Sets.newHashSet();
    for (Entry<GraphEdge, EdgeDisplayProperty> entry :
        source.edgeProperties.entrySet()) {
      GraphEdge edge = entry.getKey();
      if (nodes.contains(edge.getHead()) && nodes.contains(edge.getTail())) {
        newEdgeProperties.put(edge, entry.getValue());
        newRelations.add(edge.getRelation());
      }
    }

    Map<Relation, EdgeDisplayProperty> newRelationProps = Maps.newHashMap();
    for (Relation relation : newRelations) {
View Full Code Here

TOP

Related Classes of com.google.devtools.depan.model.GraphEdge

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.