Package de.lmu.ifi.dbs.elki.utilities.optionhandling

Examples of de.lmu.ifi.dbs.elki.utilities.optionhandling.UnspecifiedParameterException


    }
    if(obj instanceof String) {
      String[] classes = SPLIT.split((String) obj);
      // TODO: allow empty lists (and list constraints) to enforce length?
      if(classes.length == 0) {
        throw new UnspecifiedParameterException("Wrong parameter format! Given list of classes for parameter \"" + getName() + "\" is either empty or has the wrong format!");
      }

      List<Class<? extends C>> cls = new ArrayList<Class<? extends C>>(classes.length);
      for(String cl : classes) {
        try {
View Full Code Here


  /** {@inheritDoc} */
  @SuppressWarnings("unchecked")
  @Override
  protected List<Class<? extends C>> parseValue(Object obj) throws ParameterException {
    if(obj == null) {
      throw new UnspecifiedParameterException("Parameter Error.\n" + "No value for parameter \"" + getName() + "\" " + "given.");
    }
    if (List.class.isInstance(obj)) {
      List<?> l = (List<?>) obj;
      ArrayList<C> inst = new ArrayList<C>(l.size());
      ArrayList<Class<? extends C>> classes = new ArrayList<Class<? extends C>>(l.size());
View Full Code Here

  /** {@inheritDoc} */
  @Override
  protected String parseValue(Object obj) throws ParameterException {
    if(obj == null) {
      throw new UnspecifiedParameterException("Parameter \"" + getName() + "\": Null value given!");
    }
    if (obj instanceof String) {
      return (String) obj;
    }
    // TODO: allow anything convertible by toString()?
View Full Code Here

    else if(isOptional()) {
      // Optional is fine, but not successful
      return false;
    }
    else {
      throw new UnspecifiedParameterException(this);
    }
  }
View Full Code Here

      // continue with other attempts.
    }
    if(obj instanceof String) {
      String[] vectors = VECTOR_SPLIT.split((String) obj);
      if(vectors.length == 0) {
        throw new UnspecifiedParameterException("Wrong parameter format! Given list of vectors for parameter \"" + getName() + "\" is empty!");
      }
      ArrayList<List<Double>> vecs = new ArrayList<List<Double>>();

      for(String vector : vectors) {
        String[] coordinates = SPLIT.split(vector);
View Full Code Here

  /** {@inheritDoc} */
  @SuppressWarnings("unchecked")
  @Override
  protected Class<? extends C> parseValue(Object obj) throws ParameterException {
    if(obj == null) {
      throw new UnspecifiedParameterException("Parameter Error.\n" + "No value for parameter \"" + getName() + "\" " + "given.");
    }
    if(obj instanceof Class<?>) {
      return (Class<? extends C>) obj;
    }
    if(obj instanceof String) {
View Full Code Here

   * not a parameter exception is thrown.
   */
  @Override
  public boolean validate(Class<? extends C> obj) throws ParameterException {
    if(obj == null) {
      throw new UnspecifiedParameterException("Parameter Error.\n" + "No value for parameter \"" + getName() + "\" " + "given.");
    }
    if(!restrictionClass.isAssignableFrom(obj)) {
      throw new WrongParameterValueException(this, obj.getName(), "Given class not a subclass / implementation of " + restrictionClass.getName());
    }
    if(!super.validate(obj)) {
View Full Code Here

  /** {@inheritDoc} */
  @SuppressWarnings("unchecked")
  @Override
  protected Class<? extends C> parseValue(Object obj) throws ParameterException {
    if(obj == null) {
      throw new UnspecifiedParameterException("Parameter Error.\n" + "No value for parameter \"" + getName() + "\" " + "given.");
    }
    // does the given objects class fit?
    if(restrictionClass.isInstance(obj)) {
      return (Class<? extends C>) obj.getClass();
    }
View Full Code Here

  }

  @Override
  protected Pattern parseValue(Object obj) throws ParameterException {
    if(obj == null) {
      throw new UnspecifiedParameterException("Parameter \"" + getName() + "\": Null value given!");
    }
    if(obj instanceof Pattern) {
      return (Pattern) obj;
    }
    if(obj instanceof String) {
View Full Code Here

  /** {@inheritDoc} */
  @Override
  protected File parseValue(Object obj) throws ParameterException {
    if(obj == null) {
      throw new UnspecifiedParameterException("Parameter \"" + getName() + "\": No filename given!");
    }
    if(obj instanceof File) {
      return (File) obj;
    }
    if(obj instanceof String) {
      return new File((String) obj);
    }
    throw new UnspecifiedParameterException("Parameter \"" + getName() + "\": Unsupported value given!");
  }
View Full Code Here

TOP

Related Classes of de.lmu.ifi.dbs.elki.utilities.optionhandling.UnspecifiedParameterException

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.