src/share/classes/javax/print/attribute/SetOfIntegerSyntax.java
Print this page
*** 110,120 ****
* Parse the given string, returning canonical array form.
*/
private static int[][] parse(String members) {
// Create vector to hold int[] elements, each element being one range
// parsed out of members.
! Vector theRanges = new Vector();
// Run state machine over members.
int n = (members == null ? 0 : members.length());
int i = 0;
int state = 0;
--- 110,120 ----
* Parse the given string, returning canonical array form.
*/
private static int[][] parse(String members) {
// Create vector to hold int[] elements, each element being one range
// parsed out of members.
! Vector<int[]> theRanges = new Vector<>();
// Run state machine over members.
int n = (members == null ? 0 : members.length());
int i = 0;
int state = 0;
*** 241,264 ****
/**
* Accumulate the given range (lb .. ub) into the canonical array form
* into the given vector of int[] objects.
*/
! private static void accumulate(Vector ranges, int lb,int ub) {
// Make sure range is non-null.
if (lb <= ub) {
// Stick range at the back of the vector.
ranges.add(new int[] {lb, ub});
// Work towards the front of the vector to integrate the new range
// with the existing ranges.
for (int j = ranges.size()-2; j >= 0; -- j) {
// Get lower and upper bounds of the two ranges being compared.
! int[] rangea = (int[]) ranges.elementAt (j);
int lba = rangea[0];
int uba = rangea[1];
! int[] rangeb = (int[]) ranges.elementAt (j+1);
int lbb = rangeb[0];
int ubb = rangeb[1];
/* If the two ranges overlap or are adjacent, coalesce them.
* The two ranges overlap if the larger lower bound is less
--- 241,264 ----
/**
* Accumulate the given range (lb .. ub) into the canonical array form
* into the given vector of int[] objects.
*/
! private static void accumulate(Vector<int[]> ranges, int lb,int ub) {
// Make sure range is non-null.
if (lb <= ub) {
// Stick range at the back of the vector.
ranges.add(new int[] {lb, ub});
// Work towards the front of the vector to integrate the new range
// with the existing ranges.
for (int j = ranges.size()-2; j >= 0; -- j) {
// Get lower and upper bounds of the two ranges being compared.
! int[] rangea = ranges.elementAt (j);
int lba = rangea[0];
int uba = rangea[1];
! int[] rangeb = ranges.elementAt (j+1);
int lbb = rangeb[0];
int ubb = rangeb[1];
/* If the two ranges overlap or are adjacent, coalesce them.
* The two ranges overlap if the larger lower bound is less
*** 291,302 ****
}
/**
* Convert the given vector of int[] objects to canonical array form.
*/
! private static int[][] canonicalArrayForm(Vector ranges) {
! return (int[][]) ranges.toArray (new int[ranges.size()][]);
}
/**
* Construct a new set-of-integer attribute with the given members in
* array form.
--- 291,302 ----
}
/**
* Convert the given vector of int[] objects to canonical array form.
*/
! private static int[][] canonicalArrayForm(Vector<int[]> ranges) {
! return ranges.toArray (new int[ranges.size()][]);
}
/**
* Construct a new set-of-integer attribute with the given members in
* array form.
*** 321,331 ****
* Parse the given array form, returning canonical array form.
*/
private static int[][] parse(int[][] members) {
// Create vector to hold int[] elements, each element being one range
// parsed out of members.
! Vector ranges = new Vector();
// Process all integer groups in members.
int n = (members == null ? 0 : members.length);
for (int i = 0; i < n; ++ i) {
// Get lower and upper bounds of the range.
--- 321,331 ----
* Parse the given array form, returning canonical array form.
*/
private static int[][] parse(int[][] members) {
// Create vector to hold int[] elements, each element being one range
// parsed out of members.
! Vector<int[]> ranges = new Vector<>();
// Process all integer groups in members.
int n = (members == null ? 0 : members.length);
for (int i = 0; i < n; ++ i) {
// Get lower and upper bounds of the range.