@Test public void keep_only_heads() { Revision rev1 = new Revision(), rev2 = new Revision(); SimpleVersionGraph graph = SimpleVersionGraph.init( SimpleVersion.builder(rev1).build(), SimpleVersion.builder(rev2).parents(rev1).build()); KeepHeadsAndNewest<String, String, String> keep = new KeepHeadsAndNewest<>(graph, 0); assertThat(keep.test(graph.getVersionNode(rev2))).isTrue(); assertThat(keep.test(graph.getVersionNode(rev1))).isFalse(); }
@Override public boolean test(VersionNode<K, V, M> versionNode) { return heads.contains(versionNode.revision) || keepCount-- > 0; }
KeepHeadsAndNewest implements Predicate<VersionNode<K, V, M>> { @Override public boolean test(VersionNode<K, V, M> versionNode) { return heads.contains(versionNode.revision) || keepCount-- > 0; } }
KeepHeadsAndNewest implements Predicate<VersionNode<K, V, M>> { @Override public boolean test(VersionNode<K, V, M> versionNode) { return heads.contains(versionNode.revision) || keepCount-- > 0; } KeepHeadsAndNewest(VersionGraph<K, V, M> graph, int count); }
KeepHeadsAndNewest implements Predicate<VersionNode<K, V, M>> { @Override public boolean test(VersionNode<K, V, M> versionNode) { return heads.contains(versionNode.revision) || keepCount-- > 0; } KeepHeadsAndNewest(VersionGraph<K, V, M> graph, int count); @Override boolean test(VersionNode<K, V, M> versionNode); }
KeepHeadsAndNewest implements Predicate<VersionNode<K, V, M>> { @Override public boolean test(VersionNode<K, V, M> versionNode) { return heads.contains(versionNode.revision) || keepCount-- > 0; } KeepHeadsAndNewest(VersionGraph<K, V, M> graph, int count); @Override boolean test(VersionNode<K, V, M> versionNode);  }