@Test public void testCalculateTreeHeightWithOneLeafWithMetadata() throws KSIException { assertEquals(builder.calculateHeight(node, IDENTITY_METADATA), 1); }
public long calculateHeight(ImprintNode node) throws HashException { LinkedList<ImprintNode> tmpHeads = new LinkedList<>(); for (ImprintNode in : heads) { tmpHeads.add(new ImprintNode(in)); } addToHeads(tmpHeads, new ImprintNode(node)); ImprintNode root = getRootNode(tmpHeads); logger.debug("Adding node with hash {} and height {}, the hash tree height would be {}", node.getValue(), node.getLevel(), root.getLevel()); return root.getLevel(); }
HashTreeBuilder implements TreeBuilder<ImprintNode> { public long calculateHeight(ImprintNode node) throws HashException { LinkedList<ImprintNode> tmpHeads = new LinkedList<>(); for (ImprintNode in : heads) { tmpHeads.add(new ImprintNode(in)); } addToHeads(tmpHeads, new ImprintNode(node)); ImprintNode root = getRootNode(tmpHeads); logger.debug("Adding node with hash {} and height {}, the hash tree height would be {}", node.getValue(), node.getLevel(), root.getLevel()); return root.getLevel(); } }
HashTreeBuilder implements TreeBuilder<ImprintNode> { public long calculateHeight(ImprintNode node) throws HashException { LinkedList<ImprintNode> tmpHeads = new LinkedList<>(); for (ImprintNode in : heads) { tmpHeads.add(new ImprintNode(in)); } addToHeads(tmpHeads, new ImprintNode(node)); ImprintNode root = getRootNode(tmpHeads); logger.debug("Adding node with hash {} and height {}, the hash tree height would be {}", node.getValue(), node.getLevel(), root.getLevel()); return root.getLevel(); } HashTreeBuilder(HashAlgorithm algorithm);  HashTreeBuilder(); }
HashTreeBuilder implements TreeBuilder<ImprintNode> { public long calculateHeight(ImprintNode node) throws HashException { LinkedList<ImprintNode> tmpHeads = new LinkedList<>(); for (ImprintNode in : heads) { tmpHeads.add(new ImprintNode(in)); } addToHeads(tmpHeads, new ImprintNode(node)); ImprintNode root = getRootNode(tmpHeads); logger.debug("Adding node with hash {} and height {}, the hash tree height would be {}", node.getValue(), node.getLevel(), root.getLevel()); return root.getLevel(); } HashTreeBuilder(HashAlgorithm algorithm);  HashTreeBuilder(); void add(ImprintNode node); void add(ImprintNode node, IdentityMetadata metadata); long calculateHeight(ImprintNode node); long calculateHeight(ImprintNode node, IdentityMetadata metadata); void add(ImprintNode... nodes); ImprintNode build(); }
HashTreeBuilder implements TreeBuilder<ImprintNode> { public long calculateHeight(ImprintNode node) throws HashException { LinkedList<ImprintNode> tmpHeads = new LinkedList<>(); for (ImprintNode in : heads) { tmpHeads.add(new ImprintNode(in)); } addToHeads(tmpHeads, new ImprintNode(node)); ImprintNode root = getRootNode(tmpHeads); logger.debug("Adding node with hash {} and height {}, the hash tree height would be {}", node.getValue(), node.getLevel(), root.getLevel()); return root.getLevel(); } HashTreeBuilder(HashAlgorithm algorithm);  HashTreeBuilder(); void add(ImprintNode node); void add(ImprintNode node, IdentityMetadata metadata); long calculateHeight(ImprintNode node); long calculateHeight(ImprintNode node, IdentityMetadata metadata); void add(ImprintNode... nodes); ImprintNode build();  }