private void parseNamedArgumentValues(List<NamedArgument> namedArgList)
     throws IncorrectArgumentValueException {
   for (int i = 0; i < namedArgList.size(); i++) {
     NamedArgument currentArg = namedArgList.get(i);
     String errorArg = currentArg.getName();
     String[] valueSet = currentArg.getValueSet();
     if (!valueSet[0].equals("")) {
       Boolean valueSetContainsArgValue = false;
       String errorValue = "";
       for (int j = 0; j < valueSet.length; j++) {
         if (currentArg.getType().equals("integer")) {
           int intValue = (Integer) currentArg.getValue();
           if (valueSet[j].equals(Integer.toString(intValue))) {
             valueSetContainsArgValue = true;
           }
           errorValue = Integer.toString(intValue);
         } else if (currentArg.getType().equals("float")) {
           float floatValue = (Float) currentArg.getValue();
           if (valueSet[j].equals(Float.toString(floatValue))) {
             valueSetContainsArgValue = true;
           }
           errorValue = Float.toString(floatValue);
         } else if (currentArg.getType().equals("string")) {
           String stringValue = (String) currentArg.getValue();
           if (valueSet[j].equals(stringValue)) {
             valueSetContainsArgValue = true;
           }
           errorValue = stringValue;
         }
         /*else{
         	Boolean boolValue = (Boolean)currentArg.getValue();
         	if(valueSet[j].equals(boolValue)){
         		valueSetContainsArgValue = true;
         	}
         	errorValue = Boolean.toString(boolValue);
         }*/
       }
       if (!valueSetContainsArgValue) {
         throw new IncorrectArgumentValueException(
             incorrectArgumentValueMessage(errorArg, errorValue));
       }
     }
   }
 }
  /**
   * Parses input data from the command line and throws the correct exceptions if tinput data is an
   * incorrect format
   *
   * @param args the input data from the command line
   * @throws HelpException if the help argument is given in the input data
   * @throws IncorrectNumberOfArgsException if an incorrect number of positional arguments is given
   *     in the input data
   * @throws IncorrectArgTypeException if an input argument is given as the wrong dataType specified
   *     by the user
   * @throws ArgumentDoesNotExistException if a named argument is given in the input data that has
   *     not been created by the user
   * @throws IncorrectArgumentValueException if the input data is not a possible value for a
   *     specified argument
   */
  public void parse(String[] args)
      throws HelpException, IncorrectNumberOfArgsException, IncorrectArgTypeException,
          ArgumentDoesNotExistException, IncorrectArgumentValueException {
    ArrayList<String> tempPositionalArgList = getPositionalArgs(args);

    try {
      setLongFormNamedArgValues(args);
      setShortFormNamedArgValues(args);
    } catch (Exception e) {
      throw new IncorrectArgTypeException(incorrectDataTypeMessage(tempPositionalArgList));
    }

    invalidNamedArgument(args); // throws ArgumentDoesNotExistException

    NamedArgument helpArgument = getNamedArgument("help");
    if (helpArgument != null) {
      Boolean helpArgValue = (Boolean) helpArgument.getValue();
      if (helpArgValue) {
        throw new HelpException(helpMessage());
      }
    }

    if (positionalArgumentList.size() != tempPositionalArgList.size()) {
      throw new IncorrectNumberOfArgsException(incorrectNumberOfArgsMessage(tempPositionalArgList));
    } else if (positionalArgumentList.size() == tempPositionalArgList.size()) {
      for (int i = 0; i < tempPositionalArgList.size(); i++) {
        PositionalArgument currentArg = positionalArgumentList.get(i);
        currentArg.setValue(tempPositionalArgList.get(i));
      }
      try {
        parseDataType(tempPositionalArgList);
      } catch (Exception e) {
        throw new IncorrectArgTypeException(incorrectDataTypeMessage(tempPositionalArgList));
      }
      parseNamedArgumentValues(namedArgumentList); // throws IncorrectArgumentValueException
      parsePositionalArgumentValues(
          positionalArgumentList); // throws IncorrectArgumentValueException
    }
  }