@Test public void testForwardHops() { Trace trace1 = new Trace(ACCEPTED, ImmutableList.of(HOP1)); Trace trace2 = new Trace(ACCEPTED, ImmutableList.of(HOP2)); Trace trace3 = new Trace(ACCEPTED, ImmutableList.of(HOP3)); BidirectionalTrace bTrace1 = new BidirectionalTrace(FLOW1, trace1, ImmutableSet.of(), FLOW1, trace1); BidirectionalTrace bTrace2 = new BidirectionalTrace(FLOW1, trace1, ImmutableSet.of(), FLOW1, trace2); BidirectionalTrace bTrace3 = new BidirectionalTrace(FLOW1, trace1, ImmutableSet.of(), FLOW1, trace3); BidirectionalTrace bTrace4 = new BidirectionalTrace(FLOW1, trace2, ImmutableSet.of(), FLOW1, trace1); BidirectionalTrace bTrace5 = new BidirectionalTrace(FLOW1, trace3, ImmutableSet.of(), FLOW1, trace1); Collection<BidirectionalTrace> pruned = prune(ImmutableList.of(bTrace1, bTrace2, bTrace3, bTrace4, bTrace5), 3); assertThat(pruned, containsInAnyOrder(bTrace1, bTrace4, bTrace5)); }
private static List<String> forwardHops(BidirectionalTrace trace) { return hops(trace.getForwardTrace()); }
BidirectionalTracePruner { private static List<String> forwardHops(BidirectionalTrace trace) { return hops(trace.getForwardTrace()); } }
BidirectionalTracePruner { private static List<String> forwardHops(BidirectionalTrace trace) { return hops(trace.getForwardTrace()); } private  BidirectionalTracePruner(); }
BidirectionalTracePruner { private static List<String> forwardHops(BidirectionalTrace trace) { return hops(trace.getForwardTrace()); } private  BidirectionalTracePruner(); static List<BidirectionalTrace> prune(List<BidirectionalTrace> objects, int maxSize); }
BidirectionalTracePruner { private static List<String> forwardHops(BidirectionalTrace trace) { return hops(trace.getForwardTrace()); } private  BidirectionalTracePruner(); static List<BidirectionalTrace> prune(List<BidirectionalTrace> objects, int maxSize);  }