src/share/classes/javax/print/attribute/SetOfIntegerSyntax.java

Print this page


   1 /*
   2  * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  58  * the upper bound of the range; if there is only one integer in the group, the
  59  * upper bound is the same as the lower bound. If the upper bound is less than
  60  * the lower bound, it denotes a null range (no values). If the upper bound is
  61  * equal to the lower bound, it denotes a range consisting of a single value. If
  62  * the upper bound is greater than the lower bound, it denotes a range
  63  * consisting of more than one value. The ranges may appear in any order and are
  64  * allowed to overlap. The union of all the ranges gives the set's contents.
  65  * Once a SetOfIntegerSyntax instance is constructed, its value is immutable.
  66  * <P>
  67  * The SetOfIntegerSyntax object's value is actually stored in "<I>canonical</I>
  68  * array form." This is the same as array form, except there are no null ranges;
  69  * the members of the set are represented in as few ranges as possible (i.e.,
  70  * overlapping ranges are coalesced); the ranges appear in ascending order; and
  71  * each range is always represented as a length-two array of <CODE>int</CODE>s
  72  * in the form {lower bound, upper bound}. An empty set is represented as a
  73  * zero-length array.
  74  * <P>
  75  * Class SetOfIntegerSyntax has operations to return the set's members in
  76  * canonical array form, to test whether a given integer is a member of the
  77  * set, and to iterate through the members of the set.
  78  * <P>
  79  *
  80  * @author  David Mendenhall
  81  * @author  Alan Kaminsky
  82  */
  83 public abstract class SetOfIntegerSyntax implements Serializable, Cloneable {
  84 
  85     private static final long serialVersionUID = 3666874174847632203L;
  86 
  87     /**
  88      * This set's members in canonical array form.
  89      * @serial
  90      */
  91     private int[][] members;
  92 
  93 
  94     /**
  95      * Construct a new set-of-integer attribute with the given members in
  96      * string form.
  97      *
  98      * @param  members  Set members in string form. If null, an empty set is


   1 /*
   2  * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  58  * the upper bound of the range; if there is only one integer in the group, the
  59  * upper bound is the same as the lower bound. If the upper bound is less than
  60  * the lower bound, it denotes a null range (no values). If the upper bound is
  61  * equal to the lower bound, it denotes a range consisting of a single value. If
  62  * the upper bound is greater than the lower bound, it denotes a range
  63  * consisting of more than one value. The ranges may appear in any order and are
  64  * allowed to overlap. The union of all the ranges gives the set's contents.
  65  * Once a SetOfIntegerSyntax instance is constructed, its value is immutable.
  66  * <P>
  67  * The SetOfIntegerSyntax object's value is actually stored in "<I>canonical</I>
  68  * array form." This is the same as array form, except there are no null ranges;
  69  * the members of the set are represented in as few ranges as possible (i.e.,
  70  * overlapping ranges are coalesced); the ranges appear in ascending order; and
  71  * each range is always represented as a length-two array of <CODE>int</CODE>s
  72  * in the form {lower bound, upper bound}. An empty set is represented as a
  73  * zero-length array.
  74  * <P>
  75  * Class SetOfIntegerSyntax has operations to return the set's members in
  76  * canonical array form, to test whether a given integer is a member of the
  77  * set, and to iterate through the members of the set.

  78  *
  79  * @author  David Mendenhall
  80  * @author  Alan Kaminsky
  81  */
  82 public abstract class SetOfIntegerSyntax implements Serializable, Cloneable {
  83 
  84     private static final long serialVersionUID = 3666874174847632203L;
  85 
  86     /**
  87      * This set's members in canonical array form.
  88      * @serial
  89      */
  90     private int[][] members;
  91 
  92 
  93     /**
  94      * Construct a new set-of-integer attribute with the given members in
  95      * string form.
  96      *
  97      * @param  members  Set members in string form. If null, an empty set is