private Variable parseVariableSpecification(String token) throws ParseException {
  if (!token.endsWith(")")) {
    throw new ParseException("invalid variable specification '" + token + "', not properly formatted");
  }
  if (token.startsWith("R(")) {
    String content=token.substring(2,token.length() - 1);
    int index=content.indexOf(';');
    if (index >= 0) {
      double lowerBound=Double.parseDouble(content.substring(0,index));
      double upperBound=Double.parseDouble(content.substring(index + 1,content.length()));
      return EncodingUtils.newReal(lowerBound,upperBound);
    }
 else {
      throw new ParseException("invalid real specification '" + token + "', expected R(<lb>,<ub>)");
    }
  }
 else   if (token.startsWith("B(")) {
    String content=token.substring(2,token.length() - 1);
    try {
      int length=Integer.parseInt(content.trim());
      return EncodingUtils.newBinary(length);
    }
 catch (    NumberFormatException e) {
      throw new ParseException("invalid binary specification '" + token + "', expected B(<length>)");
    }
  }
 else   if (token.startsWith("P(")) {
    String content=token.substring(2,token.length() - 1);
    try {
      int length=Integer.parseInt(content.trim());
      return EncodingUtils.newPermutation(length);
    }
 catch (    NumberFormatException e) {
      throw new ParseException("invalid permutation specification '" + token + "', expected P(<length>)");
    }
  }
 else {
    throw new ParseException("invalid variable specification '" + token + "', unknown type");
  }
}

private Variable parseVariableSpecification ( String token ) throws ParseException { if ( ! token . endsWith ( ")" ) ) { throw new ParseException ( "invalid variable specification '" + token + "', not properly formatted" ) ; } if ( token . startsWith ( "R(" ) ) { String content = token . substring ( 2 , token . length ( ) - 1 ) ; int index = content . indexOf ( ';' ) ; if ( index >= 0 ) { double lowerBound = Double . parseDouble ( content . substring ( 0 , index ) ) ; double upperBound = Double . parseDouble ( content . substring ( index + 1 , content . length ( ) ) ) ; return EncodingUtils . newReal ( lowerBound , upperBound ) ; } else { throw new ParseException ( "invalid real specification '" + token + "', expected R(<lb>,<ub>)" ) ; } } else if ( token . startsWith ( "B(" ) ) { String content = token . substring ( 2 , token . length ( ) - 1 ) ; try { int length = Integer . parseInt ( content . trim ( ) ) ; return EncodingUtils . newBinary ( length ) ; } catch ( NumberFormatException e ) { throw new ParseException ( "invalid binary specification '" + token + "', expected B(<length>)" ) ; } } else if ( token . startsWith ( "P(" ) ) { String content = token . substring ( 2 , token . length ( ) - 1 ) ; try { int length = Integer . parseInt ( content . trim ( ) ) ; return EncodingUtils . newPermutation ( length ) ; } catch ( NumberFormatException e ) { throw new ParseException ( "invalid permutation specification '" + token + "', expected P(<length>)" ) ; } } else { throw new ParseException ( "invalid variable specification '" + token + "', unknown type" ) ; } }
parses a single variable specification from the command line . this method is case sensitive .
