Ancestor { Ancestor<S> createDescendant(double logProbability, S state) { return new Ancestor<>(logProbability, historyChain.append(state), bigramProvider); } private  Ancestor(double logProbability,
      HistoryChain<S> historyChain,
      @Nullable BiFunction<S, S, Bigram<S>> bigramProvider);   }
@Test void testCreateDescendant() { Ancestor<String> ancestor = Ancestor.createInitial(Ngram::create, "1", "2", "3", null); Ancestor<String> descendant = ancestor.createDescendant(-3.22, "5"); assertEquals(descendant.getHistory("4"), Arrays.asList("1", "2", "3", "4", "5")); }