src/document/Document.java
public int countWords() {
    WordCountVisitor visitor = new WordCountVisitor();
    int count = 0;

    for (TextElement element
            : content) {
      element.accept(visitor);
      count += visitor.getCount();
    }

    return count;
  }
/**
   * This counts the total number of words in the document.
   *
   * @return The number of words.
   */
This counts the total number of words in the document.
@return The number of words.
This counts the total number of words in the document . @return The number of words .
public int countWords() {
    WordCountVisitor visitor = new WordCountVisitor();
    int count = 0;
    for (TextElement element
            : content) {
      element.accept(visitor);
      count += visitor.getCount();
    }
    return count;
  }
public int countWords ( ) { WordCountVisitor visitor = new WordCountVisitor ( ) ; int count = 0 ; for ( TextElement element : content ) { element . accept ( visitor ) ; count += visitor . getCount ( ) ; } return count ; }
This counts the total number of words in the document.
This counts the total number of words in the document .