Package org.maltparserx.core.options

Examples of org.maltparserx.core.options.OptionException


   * @param desc  a short description of the legal value
   * @throws OptionException
   */
  public void addLegalValue(String value, String desc) throws MaltChainedException {
    if (value == null || value.equals("")) {
      throw new OptionException("The legal value is missing for the '"+getName()+"' option. ");
    } else if (legalValues.contains(value.toLowerCase())) {
      throw new OptionException("The legal value '"+value+"' already exists for the '"+getName()+"' option. ");
    } else {
      legalValues.add(value.toLowerCase());
      if (desc == null || desc.equals("")) {
        legalValueDesc.put(value.toLowerCase(), "Description is missing. ");
      } else {
View Full Code Here


    if (value.equalsIgnoreCase("true")) {
      return new Boolean(true);
    } else if (value.equalsIgnoreCase("false")) {
      return new Boolean(false);
    } else {
      throw new OptionException("Illegal boolean value '"+value+"' for the '"+getName()+"' option. ");
    }
  }
View Full Code Here

    if (defaultValue.equalsIgnoreCase("true")) {
      this.defaultValue = true;
    } else if (defaultValue.equalsIgnoreCase("false")) {
      this.defaultValue = false;
    } else {
      throw new OptionException("Illegal boolean default value '"+defaultValue+"' for the '"+getName()+"' option. ");
    }
  }
View Full Code Here

   * @see org.maltparser.core.options.option.Option#setDefaultValue(java.lang.String)
   */
  public void setDefaultValue(String defaultValue) throws MaltChainedException {
    if (defaultValue == null) {
      if (legalValues.isEmpty()) {
        throw new OptionException("The default value is null and the legal value set is empty for the '"+getName()+"' option. ");
      } else {
        this.defaultValue = valueMapto.get(((TreeSet<String>)valueMapto.keySet()).first());
      }
    } else if (legalValues.contains(defaultValue.toLowerCase())) {
      this.defaultValue = valueMapto.get(defaultValue.toLowerCase());
    } else if (defaultValue.equals("")) {
      this.defaultValue = defaultValue;
    } else {
      throw new OptionException("The default value '"+defaultValue+"' for the '"+getName()+"' option is not a legal value. ");
    }
  }
View Full Code Here

   * @param mapto  a mapto string value
   * @throws OptionException
   */
  public void addLegalValue(String value, String desc, String mapto) throws MaltChainedException {
    if (value == null || value.equals("")) {
      throw new OptionException("The legal value is missing for the option "+getName()+".");
    } else if (legalValues.contains(value.toLowerCase())) {
      throw new OptionException("The legal value "+value+" already exists for the option "+getName()+". ");
    } else {
      legalValues.add(value.toLowerCase());
      if (desc == null || desc.equals("")) {
        legalValueDesc.put(value.toLowerCase(), "Description is missing. ");
      } else {
        legalValueDesc.put(value.toLowerCase(), desc);
      }
      if (mapto == null || mapto.equals("")) {
        throw new OptionException("A mapto value is missing for the option "+getName()+". ");
      } else {
        valueMapto.put(value, mapto);
        maptoValue.put(mapto, value);
      }
    }
View Full Code Here

TOP

Related Classes of org.maltparserx.core.options.OptionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.