private TreeNode[] createTreeNodes(Certificate[][] certificates) { TreeNode[] children = new TreeNode[certificates.length]; for (int i = 0; i < certificates.length; i++) { TreeNode head = new TreeNode(certificates[i][0]); TreeNode parent = head; children[i] = head; for (int j = 0; j < certificates[i].length; j++) { TreeNode node = new TreeNode(certificates[i][j]); node.setParent(parent); parent.setChildren(new TreeNode[] {node}); parent = node; } } return children; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; PackageTreeNode other = (PackageTreeNode) obj; if (value == null) { if (other.value != null) return false; } else if (!value.equals(other.getValue())) { return false; } else { final TreeNode parent = getParent(); while (parent != null) { if (!parent.equals(other.getParent())) { return false; } break; } } return true; }