@Test(dataProvider = "getInvalidRanges", expectedExceptions = UaException.class) public void testInvalidRange(String indexRange) throws UaException { NumericRange.parse(indexRange); }
public static NumericRange parse(String range) throws UaException { try { String[] ss = range.split(","); Bounds[] bounds = new Bounds[ss.length]; for (int i = 0; i < ss.length; i++) { String s = ss[i]; String[] bs = s.split(":"); if (bs.length == 1) { int index = Integer.parseInt(bs[0]); bounds[i] = new Bounds(index, index); } else if (bs.length == 2) { int low = Integer.parseInt(bs[0]); int high = Integer.parseInt(bs[1]); if (low == high) throw new UaException(StatusCodes.Bad_IndexRangeInvalid); bounds[i] = new Bounds(low, high); } else { throw new UaException(StatusCodes.Bad_IndexRangeInvalid); } } return new NumericRange(range, bounds); } catch (Throwable ex) { throw new UaException(StatusCodes.Bad_IndexRangeInvalid, ex); } }
NumericRange { public static NumericRange parse(String range) throws UaException { try { String[] ss = range.split(","); Bounds[] bounds = new Bounds[ss.length]; for (int i = 0; i < ss.length; i++) { String s = ss[i]; String[] bs = s.split(":"); if (bs.length == 1) { int index = Integer.parseInt(bs[0]); bounds[i] = new Bounds(index, index); } else if (bs.length == 2) { int low = Integer.parseInt(bs[0]); int high = Integer.parseInt(bs[1]); if (low == high) throw new UaException(StatusCodes.Bad_IndexRangeInvalid); bounds[i] = new Bounds(low, high); } else { throw new UaException(StatusCodes.Bad_IndexRangeInvalid); } } return new NumericRange(range, bounds); } catch (Throwable ex) { throw new UaException(StatusCodes.Bad_IndexRangeInvalid, ex); } } }
NumericRange { public static NumericRange parse(String range) throws UaException { try { String[] ss = range.split(","); Bounds[] bounds = new Bounds[ss.length]; for (int i = 0; i < ss.length; i++) { String s = ss[i]; String[] bs = s.split(":"); if (bs.length == 1) { int index = Integer.parseInt(bs[0]); bounds[i] = new Bounds(index, index); } else if (bs.length == 2) { int low = Integer.parseInt(bs[0]); int high = Integer.parseInt(bs[1]); if (low == high) throw new UaException(StatusCodes.Bad_IndexRangeInvalid); bounds[i] = new Bounds(low, high); } else { throw new UaException(StatusCodes.Bad_IndexRangeInvalid); } } return new NumericRange(range, bounds); } catch (Throwable ex) { throw new UaException(StatusCodes.Bad_IndexRangeInvalid, ex); } } NumericRange(String range, Bounds[] bounds); }
NumericRange { public static NumericRange parse(String range) throws UaException { try { String[] ss = range.split(","); Bounds[] bounds = new Bounds[ss.length]; for (int i = 0; i < ss.length; i++) { String s = ss[i]; String[] bs = s.split(":"); if (bs.length == 1) { int index = Integer.parseInt(bs[0]); bounds[i] = new Bounds(index, index); } else if (bs.length == 2) { int low = Integer.parseInt(bs[0]); int high = Integer.parseInt(bs[1]); if (low == high) throw new UaException(StatusCodes.Bad_IndexRangeInvalid); bounds[i] = new Bounds(low, high); } else { throw new UaException(StatusCodes.Bad_IndexRangeInvalid); } } return new NumericRange(range, bounds); } catch (Throwable ex) { throw new UaException(StatusCodes.Bad_IndexRangeInvalid, ex); } } NumericRange(String range, Bounds[] bounds); String getRange(); Bounds[] getBounds(); @Override String toString(); static NumericRange parse(String range); static Object readFromValueAtRange(Variant value, NumericRange range); static Object writeToValueAtRange(Variant currentVariant, Variant updateVariant, NumericRange range); }
NumericRange { public static NumericRange parse(String range) throws UaException { try { String[] ss = range.split(","); Bounds[] bounds = new Bounds[ss.length]; for (int i = 0; i < ss.length; i++) { String s = ss[i]; String[] bs = s.split(":"); if (bs.length == 1) { int index = Integer.parseInt(bs[0]); bounds[i] = new Bounds(index, index); } else if (bs.length == 2) { int low = Integer.parseInt(bs[0]); int high = Integer.parseInt(bs[1]); if (low == high) throw new UaException(StatusCodes.Bad_IndexRangeInvalid); bounds[i] = new Bounds(low, high); } else { throw new UaException(StatusCodes.Bad_IndexRangeInvalid); } } return new NumericRange(range, bounds); } catch (Throwable ex) { throw new UaException(StatusCodes.Bad_IndexRangeInvalid, ex); } } NumericRange(String range, Bounds[] bounds); String getRange(); Bounds[] getBounds(); @Override String toString(); static NumericRange parse(String range); static Object readFromValueAtRange(Variant value, NumericRange range); static Object writeToValueAtRange(Variant currentVariant, Variant updateVariant, NumericRange range);  }