Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/print/attribute/standard/PagesPerMinute.java
38918 views
/*1* Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/24package javax.print.attribute.standard;2526import javax.print.attribute.Attribute;27import javax.print.attribute.IntegerSyntax;28import javax.print.attribute.PrintServiceAttribute;2930/**31* Class PagesPerMinute is an integer valued printing attribute that indicates32* the nominal number of pages per minute to the nearest whole number which may33* be generated by this printer (e.g., simplex, black-and-white). This attribute34* is informative, not a service guarantee. Generally, it is the value used in35* the marketing literature to describe the device. A value of 0 indicates a36* device that takes more than two minutes to process a page.37* <P>38* <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The39* category name returned by <CODE>getName()</CODE> gives the IPP attribute40* name.41* <P>42*43* @author Alan Kaminsky44*/45public final class PagesPerMinute extends IntegerSyntax46implements PrintServiceAttribute {4748private static final long serialVersionUID = -6366403993072862015L;4950/**51* Construct a new pages per minute attribute with the given integer52* value.53*54* @param value Integer value.55*56* @exception IllegalArgumentException57* (Unchecked exception) Thrown if <CODE>value</CODE> is less than 0.58*/59public PagesPerMinute(int value) {60super(value, 0, Integer.MAX_VALUE);61}6263/**64* Returns whether this pages per minute attribute is equivalent to the65* passed in object. To be equivalent, all of the following conditions66* must be true:67* <OL TYPE=1>68* <LI>69* <CODE>object</CODE> is not null.70* <LI>71* <CODE>object</CODE> is an instance of class PagesPerMinute.72* <LI>73* This pages per minute attribute's value and <CODE>object</CODE>'s74* value are equal.75* </OL>76*77* @param object Object to compare to.78*79* @return True if <CODE>object</CODE> is equivalent to this pages per80* minute attribute, false otherwise.81*/82public boolean equals(Object object) {83return (super.equals (object) &&84object instanceof PagesPerMinute);85}8687/**88* Get the printing attribute class which is to be used as the "category"89* for this printing attribute value.90* <P>91* For class PagesPerMinute, the category is class PagesPerMinute itself.92*93* @return Printing attribute class (category), an instance of class94* {@link java.lang.Class java.lang.Class}.95*/96public final Class<? extends Attribute> getCategory() {97return PagesPerMinute.class;98}99100/**101* Get the name of the category of which this attribute value is an102* instance.103* <P>104* For class PagesPerMinute, the105* category name is <CODE>"pages-per-minute"</CODE>.106*107* @return Attribute category name.108*/109public final String getName() {110return "pages-per-minute";111}112113}114115116