Examples of CumulativeAttributes


Examples of org.graphstream.util.cumulative.CumulativeAttributes

      startElement(stream, "nodes");
      for (String nodeId : graphSpells.getNodes()) {
        startElement(stream, "node");
        stream.writeAttribute("id", nodeId);

        CumulativeAttributes attr = graphSpells
            .getNodeAttributes(nodeId);
        Object label = attr.getAny("label");

        if (label != null)
          stream.writeAttribute("label", label.toString());

        CumulativeSpells spells = graphSpells.getNodeSpells(nodeId);

        if (!spells.isEternal()) {
          startElement(stream, "spells");
          for (int i = 0; i < spells.getSpellCount(); i++) {
            Spell s = spells.getSpell(i);

            startElement(stream, "spell");
            putSpellAttributes(s);
            endElement(stream, true);
          }
          endElement(stream, false);
        }

        if (attr.getAttributesCount() > 0) {
          startElement(stream, "attvalues");
          nodeAttributes.push(stream, nodeId, graphSpells);
          endElement(stream, false);
        }

        endElement(stream,
            spells.isEternal() && attr.getAttributesCount() == 0);
      }
      endElement(stream, false);

      startElement(stream, "edges");
      for (String edgeId : graphSpells.getEdges()) {
        startElement(stream, "edge");

        GraphSpells.EdgeData data = graphSpells.getEdgeData(edgeId);

        stream.writeAttribute("id", edgeId);
        stream.writeAttribute("source", data.getSource());
        stream.writeAttribute("target", data.getTarget());

        CumulativeAttributes attr = graphSpells
            .getEdgeAttributes(edgeId);

        CumulativeSpells spells = graphSpells.getEdgeSpells(edgeId);

        if (!spells.isEternal()) {
          startElement(stream, "spells");
          for (int i = 0; i < spells.getSpellCount(); i++) {
            Spell s = spells.getSpell(i);

            startElement(stream, "spell");
            putSpellAttributes(s);
            endElement(stream, true);
          }
          endElement(stream, false);
        }

        if (attr.getAttributesCount() > 0) {
          startElement(stream, "attvalues");
          edgeAttributes.push(stream, edgeId, graphSpells);
          endElement(stream, false);
        }

        endElement(stream,
            spells.isEternal() && attr.getAttributesCount() == 0);
      }
      endElement(stream, false);

      endElement(stream, false);
    } catch (XMLStreamException e1) {
View Full Code Here

Examples of org.graphstream.util.cumulative.CumulativeAttributes

    GEXFAttributeMap(String type, GraphSpells spells) {
      this.type = type;

      if (type.equals("node")) {
        for (String nodeId : spells.getNodes()) {
          CumulativeAttributes attr = spells
              .getNodeAttributes(nodeId);

          for (String key : attr.getAttributes()) {
            for (Spell s : attr.getAttributeSpells(key)) {
              Object value = s.getAttachedData();
              check(key, value);
            }
          }
        }
      } else {
        for (String edgeId : spells.getEdges()) {
          CumulativeAttributes attr = spells
              .getEdgeAttributes(edgeId);

          for (String key : attr.getAttributes()) {
            for (Spell s : attr.getAttributeSpells(key)) {
              Object value = s.getAttachedData();
              check(key, value);
            }
          }
        }
View Full Code Here

Examples of org.graphstream.util.cumulative.CumulativeAttributes

      endElement(stream, true);
    }

    void push(XMLStreamWriter stream, String elementId, GraphSpells spells)
        throws XMLStreamException {
      CumulativeAttributes attr;

      if (type.equals("node"))
        attr = spells.getNodeAttributes(elementId);
      else
        attr = spells.getEdgeAttributes(elementId);

      for (String key : attr.getAttributes()) {
        for (Spell s : attr.getAttributeSpells(key)) {
          Object value = s.getAttachedData();
          String id = getID(key, value);
          GEXFAttribute a = get(id);

          if (a == 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.