@Test public void shouldNotRecognizeInvalidCases() { { final List<Root> rootsForPartialInput = findRootsForPartialInput("3", "3-41"); assertThat(rootsForPartialInput, hasSize(0)); } { final List<Root> rootsForPartialInput = findRootsForPartialInput("3-", "3-41"); assertThat(rootsForPartialInput, hasSize(0)); } { final List<Root> rootsForPartialInput = findRootsForPartialInput("3-4", "3-41"); assertThat(rootsForPartialInput, hasSize(0)); } { final List<Root> rootsForPartialInput = findRootsForPartialInput("3-41", "3-412"); assertThat(rootsForPartialInput, hasSize(0)); } { final List<Root> rootsForPartialInput = findRootsForPartialInput("3-a", "3-a"); assertThat(rootsForPartialInput, hasSize(0)); } { final List<Root> rootsForPartialInput = findRootsForPartialInput("3-12.", "3-12."); assertThat(rootsForPartialInput, hasSize(0)); } { final List<Root> rootsForPartialInput = findRootsForPartialInput("2-3'", "2-3'e"); assertThat(rootsForPartialInput, hasSize(0)); } { final List<Root> rootsForPartialInput = findRootsForPartialInput("a-2", "a-2"); assertThat(rootsForPartialInput, hasSize(0)); } { final List<Root> rootsForPartialInput = findRootsForPartialInput("1-2-", "1-2-3"); assertThat(rootsForPartialInput, hasSize(0)); } { final List<Root> rootsForPartialInput = findRootsForPartialInput("1-2-3", "1-2-34"); assertThat(rootsForPartialInput, hasSize(0)); } { final List<Root> rootsForPartialInput = findRootsForPartialInput("1-2-3-", "1-2-3-4"); assertThat(rootsForPartialInput, hasSize(0)); } }
@Override public List<Root> findRootsForPartialInput(final TurkishSequence partialInput, final TurkishSequence input) { final String partialInputUnderlyingString = partialInput.getUnderlyingString(); final String underlyingNumeralText = this.getUnderlyingNumeralTextForRange(partialInputUnderlyingString); final ImmutableSet<PhoneticAttribute> phoneticAttributes = ImmutableSet.copyOf(this.phoneticsAnalyzer.calculatePhoneticAttributes(underlyingNumeralText, null)); return Arrays.asList((Root) new NumeralRoot(partialInput, underlyingNumeralText, SecondaryPos.Range, phoneticAttributes)); }
RangeDigitsRootFinder implements RootFinder { @Override public List<Root> findRootsForPartialInput(final TurkishSequence partialInput, final TurkishSequence input) { final String partialInputUnderlyingString = partialInput.getUnderlyingString(); final String underlyingNumeralText = this.getUnderlyingNumeralTextForRange(partialInputUnderlyingString); final ImmutableSet<PhoneticAttribute> phoneticAttributes = ImmutableSet.copyOf(this.phoneticsAnalyzer.calculatePhoneticAttributes(underlyingNumeralText, null)); return Arrays.asList((Root) new NumeralRoot(partialInput, underlyingNumeralText, SecondaryPos.Range, phoneticAttributes)); } }
RangeDigitsRootFinder implements RootFinder { @Override public List<Root> findRootsForPartialInput(final TurkishSequence partialInput, final TurkishSequence input) { final String partialInputUnderlyingString = partialInput.getUnderlyingString(); final String underlyingNumeralText = this.getUnderlyingNumeralTextForRange(partialInputUnderlyingString); final ImmutableSet<PhoneticAttribute> phoneticAttributes = ImmutableSet.copyOf(this.phoneticsAnalyzer.calculatePhoneticAttributes(underlyingNumeralText, null)); return Arrays.asList((Root) new NumeralRoot(partialInput, underlyingNumeralText, SecondaryPos.Range, phoneticAttributes)); } RangeDigitsRootFinder(); }
RangeDigitsRootFinder implements RootFinder { @Override public List<Root> findRootsForPartialInput(final TurkishSequence partialInput, final TurkishSequence input) { final String partialInputUnderlyingString = partialInput.getUnderlyingString(); final String underlyingNumeralText = this.getUnderlyingNumeralTextForRange(partialInputUnderlyingString); final ImmutableSet<PhoneticAttribute> phoneticAttributes = ImmutableSet.copyOf(this.phoneticsAnalyzer.calculatePhoneticAttributes(underlyingNumeralText, null)); return Arrays.asList((Root) new NumeralRoot(partialInput, underlyingNumeralText, SecondaryPos.Range, phoneticAttributes)); } RangeDigitsRootFinder(); @Override boolean handles(TurkishSequence partialInput, TurkishSequence input); @Override List<Root> findRootsForPartialInput(final TurkishSequence partialInput, final TurkishSequence input); }
RangeDigitsRootFinder implements RootFinder { @Override public List<Root> findRootsForPartialInput(final TurkishSequence partialInput, final TurkishSequence input) { final String partialInputUnderlyingString = partialInput.getUnderlyingString(); final String underlyingNumeralText = this.getUnderlyingNumeralTextForRange(partialInputUnderlyingString); final ImmutableSet<PhoneticAttribute> phoneticAttributes = ImmutableSet.copyOf(this.phoneticsAnalyzer.calculatePhoneticAttributes(underlyingNumeralText, null)); return Arrays.asList((Root) new NumeralRoot(partialInput, underlyingNumeralText, SecondaryPos.Range, phoneticAttributes)); } RangeDigitsRootFinder(); @Override boolean handles(TurkishSequence partialInput, TurkishSequence input); @Override List<Root> findRootsForPartialInput(final TurkishSequence partialInput, final TurkishSequence input);  }