### Question:
ADTHypothesis extends AbstractFastMutableDet<ADTState<I, O>, I, ADTTransition<I, O>, Void, O> implements MutableMealyMachine<ADTState<I, O>, I, ADTTransition<I, O>, O>, AccessSequenceTransformer<I> { @Override public void setTransition(final ADTState<I, O> state, I input, final ADTTransition<I, O> transition) { final ADTTransition<I, O> oldTrans = getTransition(state, input); if (oldTrans != null) { oldTrans.getTarget().getIncomingTransitions().remove(oldTrans); } super.setTransition(state, input, transition); if (transition != null) { transition.setSource(state); transition.setInput(input); } } ADTHypothesis(final Alphabet<I> alphabet); @Override ADTState<I, O> getSuccessor(final ADTTransition<I, O> transition); ADTTransition<I, O> createOpenTransition(final ADTState<I, O> source,
                                                    final I input,
                                                    final ADTNode<ADTState<I, O>, I, O> siftTarget); @Override void setTransition(final ADTState<I, O> state, I input, final ADTTransition<I, O> transition); @Override ADTTransition<I, O> createTransition(final ADTState<I, O> successor, final O properties); @Override void setTransitionOutput(final ADTTransition<I, O> transition, final O output); @Override O getTransitionOutput(final ADTTransition<I, O> transition); @SuppressWarnings("nullness") // hypothesis is always complete @Override Word<I> transformAccessSequence(final Word<I> word); @SuppressWarnings("nullness") // hypothesis is always complete @Override boolean isAccessSequence(final Word<I> word);  }### Answer:
@Test public void testAutomaton() { final int states = 10; final Alphabet<Character> alphabet = Alphabets.characters('a', 'd'); final ADTHypothesis<Character, Integer> automaton = new ADTHypothesis<>(alphabet); automaton.addInitialState(); for (int i = 1; i < states; i++) { automaton.addState(); } Assert.assertEquals(states, automaton.size()); automaton.getStates().forEach(x -> Assert.assertTrue(x.getIncomingTransitions().isEmpty())); final StateIDs<ADTState<Character, Integer>> stateIds = automaton.stateIDs(); for (int s = 0; s < automaton.size(); s++) { for (final Character i : alphabet) { automaton.addTransition(stateIds.getState(s), i, automaton.getInitialState(), 0); } } Assert.assertEquals(states * alphabet.size(), automaton.getInitialState().getIncomingTransitions().size()); final ADTState<Character, Integer> s1 = stateIds.getState(1), s2 = stateIds.getState(2), s3 = stateIds.getState(3); automaton.removeAllTransitions(s1); Assert.assertEquals((states - 1) * alphabet.size(), automaton.getInitialState().getIncomingTransitions().size()); automaton.removeAllTransitions(s2, alphabet.getSymbol(0)); Assert.assertEquals((states - 1) * alphabet.size() - 1, automaton.getInitialState().getIncomingTransitions().size()); automaton.addTransition(s2, alphabet.getSymbol(0), s1, 0); for (int i = 1; i < alphabet.size(); i++) { ADTTransition<Character, Integer> transition = automaton.getTransition(s2, alphabet.getSymbol(i)); transition.setTarget(s1); } Assert.assertEquals(alphabet.size(), s1.getIncomingTransitions().size()); for (int i = 0; i < alphabet.size(); i++) { automaton.setTransition(s3, alphabet.getSymbol(i), s1, 0); } Assert.assertEquals(alphabet.size() * 2, s1.getIncomingTransitions().size()); }