/** * Returns the next element in the iteration. * * @return the next element */ @Override public String next() { String result; result = m_CurrentLeaf.getString(); result = result.substring(0, result.length() - 1); // remove STOP if (m_CurrentLeaf != m_LastLeaf) { m_CurrentLeaf = (TrieNode) m_CurrentLeaf.getNextLeaf(); } else { m_CurrentLeaf = null; } return result; }
/** * Returns the next element in the iteration. * * @return the next element */ @Override public String next() { String result; result = m_CurrentLeaf.getString(); result = result.substring(0, result.length() - 1); // remove STOP if (m_CurrentLeaf != m_LastLeaf) { m_CurrentLeaf = (TrieNode) m_CurrentLeaf.getNextLeaf(); } else { m_CurrentLeaf = null; } return result; }
/** * returns the number of stored strings, i.e., leaves * * @return the number of stored strings */ public int size() { int result; TrieNode leaf; result = 0; leaf = (TrieNode) getFirstLeaf(); while (leaf != null) { if (leaf != getRoot()) { result++; } leaf = (TrieNode) leaf.getNextLeaf(); } return result; }
/** * returns the number of stored strings, i.e., leaves * * @return the number of stored strings */ public int size() { int result; TrieNode leaf; result = 0; leaf = (TrieNode) getFirstLeaf(); while (leaf != null) { if (leaf != getRoot()) { result++; } leaf = (TrieNode) leaf.getNextLeaf(); } return result; }