Source Code Cross Referenced for NumberUpSupported.java in  » 6.0-JDK-Core » print » javax » print » attribute » standard » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » print » javax.print.attribute.standard 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 2000-2004 Sun Microsystems, Inc.  All Rights Reserved.
003         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004         *
005         * This code is free software; you can redistribute it and/or modify it
006         * under the terms of the GNU General Public License version 2 only, as
007         * published by the Free Software Foundation.  Sun designates this
008         * particular file as subject to the "Classpath" exception as provided
009         * by Sun in the LICENSE file that accompanied this code.
010         *
011         * This code is distributed in the hope that it will be useful, but WITHOUT
012         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014         * version 2 for more details (a copy is included in the LICENSE file that
015         * accompanied this code).
016         *
017         * You should have received a copy of the GNU General Public License version
018         * 2 along with this work; if not, write to the Free Software Foundation,
019         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020         *
021         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022         * CA 95054 USA or visit www.sun.com if you need additional information or
023         * have any questions.
024         */
025        package javax.print.attribute.standard;
026
027        import javax.print.attribute.Attribute;
028        import javax.print.attribute.SetOfIntegerSyntax;
029        import javax.print.attribute.SupportedValuesAttribute;
030
031        /**
032         * Class NumberUpSupported is a printing attribute class, a set of integers, 
033         * that gives the supported values for a {@link NumberUp NumberUp} attribute. 
034         * <P>
035         * <B>IPP Compatibility:</B> The NumberUpSupported attribute's canonical array 
036         * form gives the lower and upper bound for each range of number-up to be 
037         * included in an IPP "number-up-supported" attribute. See class {@link 
038         * javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an 
039         * explanation of canonical array form. The category name returned by 
040         * <CODE>getName()</CODE> gives the IPP attribute name. 
041         * <P>
042         *
043         * @author  Alan Kaminsky
044         */
045        public final class NumberUpSupported extends SetOfIntegerSyntax
046                implements  SupportedValuesAttribute {
047
048            private static final long serialVersionUID = -1041573395759141805L;
049
050            /**
051             * Construct a new number up supported attribute with the given members.
052             * The supported values for NumberUp are specified in "array form;" see 
053             * class 
054             * {@link javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} 
055             * for an explanation of array form. 
056             *
057             * @param  members  Set members in array form.
058             *
059             * @exception  NullPointerException
060             *     (unchecked exception) Thrown if <CODE>members</CODE> is null or 
061             *     any element of <CODE>members</CODE> is null. 
062             * @exception  IllegalArgumentException
063             *     (unchecked exception) Thrown if any element of 
064             *   <CODE>members</CODE> is not a length-one or length-two array. Also 
065             *    thrown if <CODE>members</CODE> is a zero-length array or if any 
066             *    member of the set is less than 1. 
067             */
068            public NumberUpSupported(int[][] members) {
069                super (members);
070                if (members == null) {
071                    throw new NullPointerException("members is null");
072                }
073                int[][] myMembers = getMembers();
074                int n = myMembers.length;
075                if (n == 0) {
076                    throw new IllegalArgumentException("members is zero-length");
077                }
078                int i;
079                for (i = 0; i < n; ++i) {
080                    if (myMembers[i][0] < 1) {
081                        throw new IllegalArgumentException(
082                                "Number up value must be > 0");
083                    }
084                }
085            }
086
087            /**
088             * Construct a new number up supported attribute containing a single 
089             * integer. That is, only the one value of NumberUp is supported. 
090             *
091             * @param  member  Set member.
092             *
093             * @exception  IllegalArgumentException
094             *     (Unchecked exception) Thrown if <CODE>member</CODE> is less than 
095             *     1. 
096             */
097            public NumberUpSupported(int member) {
098                super (member);
099                if (member < 1) {
100                    throw new IllegalArgumentException(
101                            "Number up value must be > 0");
102                }
103            }
104
105            /**
106             * Construct a new number up supported attribute containing a single range 
107             * of integers. That is, only those values of NumberUp in the one range are 
108             * supported. 
109             *
110             * @param  lowerBound  Lower bound of the range.
111             * @param  upperBound  Upper bound of the range.
112             *
113             * @exception  IllegalArgumentException
114             *     (Unchecked exception) Thrown if a null range is specified or if a 
115             *     non-null range is specified with <CODE>lowerBound</CODE> less than 
116             *     1. 
117             */
118            public NumberUpSupported(int lowerBound, int upperBound) {
119                super (lowerBound, upperBound);
120                if (lowerBound > upperBound) {
121                    throw new IllegalArgumentException("Null range specified");
122                } else if (lowerBound < 1) {
123                    throw new IllegalArgumentException(
124                            "Number up value must be > 0");
125                }
126            }
127
128            /**
129             * Returns whether this number up supported attribute is equivalent to the 
130             * passed in object. To be equivalent, all of the following conditions 
131             * must be true: 
132             * <OL TYPE=1>
133             * <LI>
134             * <CODE>object</CODE> is not null.
135             * <LI>
136             * <CODE>object</CODE> is an instance of class NumberUpSupported.
137             * <LI>
138             * This number up supported attribute's members and <CODE>object</CODE>'s 
139             * members are the same. 
140             * </OL>
141             *
142             * @param  object  Object to compare to.
143             *
144             * @return  True if <CODE>object</CODE> is equivalent to this number up
145             *          supported attribute, false otherwise. 
146             */
147            public boolean equals(Object object) {
148                return (super .equals(object) && object instanceof  NumberUpSupported);
149            }
150
151            /**
152             * Get the printing attribute class which is to be used as the "category" 
153             * for this printing attribute value.
154             * <P>
155             * For class NumberUpSupported, the 
156             * category is class NumberUpSupported itself. 
157             *
158             * @return  Printing attribute class (category), an instance of class
159             *          {@link java.lang.Class java.lang.Class}.
160             */
161            public final Class<? extends Attribute> getCategory() {
162                return NumberUpSupported.class;
163            }
164
165            /**
166             * Get the name of the category of which this attribute value is an 
167             * instance. 
168             * <P>
169             * For class NumberUpSupported, the 
170             * category name is <CODE>"number-up-supported"</CODE>.
171             *
172             * @return  Attribute category name.
173             */
174            public final String getName() {
175                return "number-up-supported";
176            }
177
178        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.