@Override public int compare(Node o1, Node o2) { Comparable a1 = (Comparable) o1.getAttribute(column); Comparable a2 = (Comparable) o2.getAttribute(column); if (a1 == null && a2 != null) { return 1; } else if (a1 != null && a2 == null) { return -1; } else if (a1 == null && a2 == null) { return 0; } else { return a2.compareTo(a1); } } });
@Override public boolean evaluate(Graph graph, Node node) { Integer component = (Integer) node.getAttribute(column); if (component != null) { return component.equals(componentId); } return false; }
@Override public int compare(Node o1, Node o2) { Number n1 = (Number) o1.getAttribute(column); Number n2 = (Number) o2.getAttribute(column); if (n1.doubleValue() < n2.doubleValue()) { return 1; } else if (n1.doubleValue() > n2.doubleValue()) { return -1; } else { return 0; } } });
@Override public int compare(Item o1, Item o2) { Node n1 = (Node) o1.getSource(); Node n2 = (Node) o2.getSource(); Number s1 = (Number) n1.getAttribute(sortColumn); Number s2 = (Number) n2.getAttribute(sortColumn); double size1 = s1 == null ? Double.NEGATIVE_INFINITY : s1.doubleValue(); double size2 = s2 == null ? Double.NEGATIVE_INFINITY : s2.doubleValue(); return size1 > size2 ? 1 : size1 < size2 ? -1 : 0; } });
private String getLabel(Node n, Column[] cols, GraphView view) { String str = ""; if (cols != null) { int i = 0; for (Column c : cols) { if (i++ > 0) { str += " - "; } Object val = n.getAttribute(c, view); str += val != null ? val : ""; } } if (str.isEmpty()) { str = n.getLabel(); } if (str == null) { str = ""; } return str; }
value = node.getAttribute(column); if (value != null) { strValue = AttributeUtils.print(value, timeFormat, timeZone);
Integer v = (Integer) n.getAttribute(MODULARITY_CLASS); if (!sizeDist.containsKey(v)) { sizeDist.put(v, 0);
System.out.println(n.getAttribute(sourceCol)); System.out.println(n.getAttribute("source"));
value = node.getAttribute(table.getColumn(searchResult.getFoundColumnIndex())); } else { Edge edge = searchResult.getFoundEdge();
Graph graph = graphModel.getGraph(); for (Node n : graph.getNodes()) { TimestampIntegerMap value = (TimestampIntegerMap) n.getAttribute("price"); System.out.println("'" + n.getLabel() + "': " + value.toString()); TimestampIntegerMap value = (TimestampIntegerMap) n.getAttribute("price");
if (searchAllColumns || columnsToSearch.contains(columnIndex)) { column = table.getColumn(columnIndex); value = row.getAttribute(column); result = matchRegex(value, searchOptions, rowIndex, columnIndex, timeFormat, timeZone); if (result != null) {
private Node copyNode(Node node, Graph graph) { Node copy = buildNode(graph, node.getLabel()); //Copy properties (position, size and color): copy.setX(node.x()); copy.setY(node.y()); copy.setZ(node.z()); copy.setSize(node.size()); copy.setR(node.r()); copy.setG(node.g()); copy.setB(node.b()); copy.setAlpha(node.alpha()); Table nodeTable = graph.getModel().getNodeTable(); //Copy attributes: for (Column column : nodeTable) { if (!column.isReadOnly()) { copy.setAttribute(column, node.getAttribute(column)); } } graph.addNode(copy); return copy; }