/** * * @param source * @param target */ public static void copyAttributes(Element source, Element target) { for (String key : source.getAttributeKeySet()) { Object value = source.getAttribute(key); value = checkedArrayOrCollectionCopy(value); target.setAttribute(key, value); } }
/** * * @param source * @param target */ public static void copyAttributes(Element source, Element target) { for (String key : source.getAttributeKeySet()) { Object value = source.getAttribute(key); value = checkedArrayOrCollectionCopy(value); target.setAttribute(key, value); } }
GEXFAttributeMap(String type, Graph g) { this.type = type; Iterable<? extends Element> iterable; if (type.equals("node")) iterable = (Iterable<? extends Element>) g.getNodeSet(); else iterable = (Iterable<? extends Element>) g.getEdgeSet(); for (Element e : iterable) { for (String key : e.getAttributeKeySet()) { Object value = e.getAttribute(key); check(key, value); } } }
GEXFAttributeMap(String type, Graph g) { this.type = type; Iterable<? extends Element> iterable; if (type.equals("node")) iterable = (Iterable<? extends Element>) g.getNodeSet(); else iterable = (Iterable<? extends Element>) g.getEdgeSet(); for (Element e : iterable) { for (String key : e.getAttributeKeySet()) { Object value = e.getAttribute(key); check(key, value); } } }
private void attributeDiff(ElementType type, Element e1, Element e2) { if (e1 == null && e2 == null) return; else if (e1 == null) { for (String key : e2.getAttributeKeySet()) events.add(new AttributeAdded(type, e2.getId(), key, e2 .getAttribute(key))); } else if (e2 == null) { for (String key : e1.getAttributeKeySet()) events.add(new AttributeRemoved(type, e1.getId(), key, e1 .getAttribute(key))); } else { for (String key : e2.getAttributeKeySet()) { if (e1.hasAttribute(key)) { Object o1 = e1.getAttribute(key); Object o2 = e2.getAttribute(key); if (!(o1 == null ? o2 == null : o1.equals(o2))) events.add(new AttributeChanged(type, e1.getId(), key, o2, o1)); } else events.add(new AttributeAdded(type, e1.getId(), key, e2 .getAttribute(key))); } for (String key : e1.getAttributeKeySet()) { if (!e2.hasAttribute(key)) events.add(new AttributeRemoved(type, e1.getId(), key, e1 .getAttribute(key))); } } }
private void attributeDiff(ElementType type, Element e1, Element e2) { if (e1 == null && e2 == null) return; else if (e1 == null) { for (String key : e2.getAttributeKeySet()) events.add(new AttributeAdded(type, e2.getId(), key, e2 .getAttribute(key))); } else if (e2 == null) { for (String key : e1.getAttributeKeySet()) events.add(new AttributeRemoved(type, e1.getId(), key, e1 .getAttribute(key))); } else { for (String key : e2.getAttributeKeySet()) { if (e1.hasAttribute(key)) { Object o1 = e1.getAttribute(key); Object o2 = e2.getAttribute(key); if (!(o1 == null ? o2 == null : o1.equals(o2))) events.add(new AttributeChanged(type, e1.getId(), key, o2, o1)); } else events.add(new AttributeAdded(type, e1.getId(), key, e2 .getAttribute(key))); } for (String key : e1.getAttributeKeySet()) { if (!e2.hasAttribute(key)) events.add(new AttributeRemoved(type, e1.getId(), key, e1 .getAttribute(key))); } } }