Exemplo n.º 1
0
  /**
   * Creates a new Language and adds it into the Collection.
   *
   * @param words Words of the language that will be created.
   * @throws JOpLenException If something goes wrong.
   */
  public void newLanguage(String[] words) throws JOpLenException {
    Language language = new Language();

    for (String word : words) {
      if (belongsToAlphabet(word)) {
        language.addWord(word);
      } else {
        throw new JOpLenException(
            "Los símbolos de la palabra '" + word + "' no pertenecen al alfabeto");
      }
    }

    language.setName(NameFactory.getInstance().getLanguageName());
    addLanguage(language);
  }