public static NumericRange parse(String textToParse) throws ServiceResultException {
  if (textToParse == null || textToParse.length() == 0) {
    return NumericRange.getEmpty();
  }
  NumericRange range=new NumericRange();
  String[] dims=textToParse.split(",");
  range.setDimensions(dims.length);
  for (int d=0; d < dims.length; d++)   try {
    String dimStr=dims[d];
    String[] indexes=dimStr.split(":");
    if (indexes.length > 1) {
      range.setBegin(d,Integer.parseInt(indexes[0]));
      range.setEnd(d,Integer.parseInt(indexes[1]));
      if (range.getBegin(d) == range.getEnd(d))       throw new IllegalArgumentException("Begin = End");
    }
 else {
      range.setBegin(d,Integer.parseInt(indexes[0]));
    }
  }
 catch (  Exception e) {
    throw new ServiceResultException(StatusCodes.Bad_IndexRangeInvalid,e,"Cannot parse numeric range: " + textToParse + ".");
  }
  return range;
}

public static NumericRange parse ( String textToParse ) throws ServiceResultException { if ( textToParse == null || textToParse . length ( ) == 0 ) { return NumericRange . getEmpty ( ) ; } NumericRange range = new NumericRange ( ) ; String [ ] dims = textToParse . split ( "," ) ; range . setDimensions ( dims . length ) ; for ( int d = 0 ; d < dims . length ; d ++ ) try { String dimStr = dims [ d ] ; String [ ] indexes = dimStr . split ( ":" ) ; if ( indexes . length > 1 ) { range . setBegin ( d , Integer . parseInt ( indexes [ 0 ] ) ) ; range . setEnd ( d , Integer . parseInt ( indexes [ 1 ] ) ) ; if ( range . getBegin ( d ) == range . getEnd ( d ) ) throw new IllegalArgumentException ( "Begin = End" ) ; } else { range . setBegin ( d , Integer . parseInt ( indexes [ 0 ] ) ) ; } } catch ( Exception e ) { throw new ServiceResultException ( StatusCodes . Bad_IndexRangeInvalid , e , "Cannot parse numeric range: " + textToParse + "." ) ; } return range ; }
parses a string representing a numeric range .
