Examples of OptionException


Examples of org.maltparserx.core.options.OptionException

   * @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

Examples of org.maltparserx.core.options.OptionException

   * @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
Copyright © 2018 www.massapi.com. 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.