/** * checks whether a suffix can be found in its children * * @param suffix the suffix to look for * @return true if suffix was found */ public boolean contains(String suffix) { boolean result; Character c; String newSuffix; TrieNode child; c = suffix.charAt(0); newSuffix = suffix.substring(1); child = m_Children.get(c); if (child == null) { result = false; } else if (newSuffix.length() == 0) { result = true; } else { result = child.contains(newSuffix); } return result; }
/** * checks whether a suffix can be found in its children * * @param suffix the suffix to look for * @return true if suffix was found */ public boolean contains(String suffix) { boolean result; Character c; String newSuffix; TrieNode child; c = suffix.charAt(0); newSuffix = suffix.substring(1); child = m_Children.get(c); if (child == null) { result = false; } else if (newSuffix.length() == 0) { result = true; } else { result = child.contains(newSuffix); } return result; }
/** * checks whether the given prefix is stored in the trie * * @param prefix the prefix to check * @return true if the prefix is part of the trie */ public boolean containsPrefix(String prefix) { return m_Root.contains(prefix); }
/** * Returns true if this collection contains the specified element. * * @param o the object to check for in trie * @return true if found */ @Override public boolean contains(Object o) { return m_Root.contains(((String) o) + TrieNode.STOP); }
/** * checks whether the given prefix is stored in the trie * * @param prefix the prefix to check * @return true if the prefix is part of the trie */ public boolean containsPrefix(String prefix) { return m_Root.contains(prefix); }
/** * Returns true if this collection contains the specified element. * * @param o the object to check for in trie * @return true if found */ @Override public boolean contains(Object o) { return m_Root.contains(((String) o) + TrieNode.STOP); }