protected int determineIndex(String s,int numAttributes) throws Exception {
  int result;
  if (s.equals("first")) {
    result=0;
  }
 else   if (s.equals("last")) {
    result=numAttributes - 1;
  }
 else {
    result=Integer.parseInt(s) - 1;
  }
  if ((result < 0) || (result > numAttributes - 1)) {
    throw new IllegalArgumentException("'" + s + "' is not a valid index for the range '1-"+ numAttributes+ "'!");
  }
  return result;
}

protected int determineIndex ( String s , int numAttributes ) throws Exception { int result ; if ( s . equals ( "first" ) ) { result = 0 ; } else if ( s . equals ( "last" ) ) { result = numAttributes - 1 ; } else { result = Integer . parseInt ( s ) - 1 ; } if ( ( result < 0 ) || ( result > numAttributes - 1 ) ) { throw new IllegalArgumentException ( "'" + s + "' is not a valid index for the range '1-" + numAttributes + "'!" ) ; } return result ; }
parses the index string and returns the corresponding int index
