1/* 2 ******************************************************************************* 3 * Copyright (C) 2012, International Business Machines Corporation and * 4 * others. All Rights Reserved. * 5 ******************************************************************************* 6 */ 7package com.ibm.icu.text; 8 9import java.text.CharacterIterator; 10 11/** 12 * The DictionaryMatcher interface is used to allow arbitrary "types" of 13 * back-end data structures to be used with the break iteration code. 14 */ 15abstract class DictionaryMatcher { 16 /** 17 * Find dictionary words that match the text. 18 * 19 * @param text A CharacterIterator representing the text. The iterator is 20 * left after the longest prefix match in the dictionary. 21 * @param maxLength The maximum number of code units to match. 22 * @param lengths An array that is filled with the lengths of words that matched. 23 * @param count Filled with the number of elements output in lengths. 24 * @param limit The maximum amount of words to output. Must be less than or equal to lengths.length. 25 * @param values Filled with the weight values associated with the various words. 26 * @return The number of characters in text that were matched. 27 */ 28 public abstract int matches(CharacterIterator text, int maxLength, int[] lengths, 29 int[] count, int limit, int[] values); 30 31 public int matches(CharacterIterator text, int maxLength, int[] lengths, 32 int[] count, int limit) { 33 return matches(text, maxLength, lengths, count, limit, null); 34 } 35 36 /** 37 * @return the kind of dictionary that this matcher is using 38 */ 39 public abstract int getType(); 40} 41