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 23 * questions. 24 */ 25 package javax.print.attribute.standard; 26 27 import javax.print.attribute.Attribute; 28 import javax.print.attribute.IntegerSyntax; 29 import javax.print.attribute.PrintJobAttribute; 30 31 /** 32 * Class JobMediaSheetsCompleted is an integer valued printing attribute class 33 * that specifies the number of media sheets which have completed marking and 34 * stacking for the entire job so far, whether those sheets have been processed 35 * on one side or on both. 36 * <P> 37 * The JobMediaSheetsCompleted attribute describes the progress of the job. This 38 * attribute is intended to be a counter. That is, the JobMediaSheetsCompleted 39 * value for a job that has not started processing must be 0. When the job's 40 * {@link JobState JobState} is PROCESSING or PROCESSING_STOPPED, the 41 * JobMediaSheetsCompleted value is intended to increase as the job is 42 * processed; it indicates the amount of the job that has been processed at the 43 * time the Print Job's attribute set is queried or at the time a print job 44 * event is reported. When the job enters the COMPLETED, CANCELED, or ABORTED 45 * states, the JobMediaSheetsCompleted value is the final value for the job. 46 * <P> 47 * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The 48 * category name returned by {@code getName()} gives the IPP attribute 49 * name. 50 * 51 * @see JobMediaSheets 52 * @see JobMediaSheetsSupported 53 * @see JobKOctetsProcessed 54 * @see JobImpressionsCompleted 55 * 56 * @author Alan Kaminsky 57 */ 58 public final class JobMediaSheetsCompleted extends IntegerSyntax 59 implements PrintJobAttribute { 60 61 62 private static final long serialVersionUID = 1739595973810840475L; 63 64 /** 65 * Construct a new job media sheets completed attribute with the given 66 * integer value. 67 * 68 * @param value Integer value. 69 * 70 * @exception IllegalArgumentException 71 * (Unchecked exception) Thrown if {@code value} is less than 0. 72 */ 73 public JobMediaSheetsCompleted(int value) { 74 super (value, 0, Integer.MAX_VALUE); 75 } 76 77 /** 78 * Returns whether this job media sheets completed attribute is equivalent 79 * to the passed in object. To be equivalent, all of the following 80 * conditions must be true: 81 * <OL TYPE=1> 82 * <LI> 83 * {@code object} is not null. 84 * <LI> 85 * {@code object} is an instance of class JobMediaSheetsCompleted. 86 * <LI> 87 * This job media sheets completed attribute's value and 88 * {@code object}'s value are equal. 89 * </OL> 90 * 91 * @param object Object to compare to. 92 * 93 * @return True if {@code object} is equivalent to this job media 94 * sheets completed attribute, false otherwise. 95 */ 96 public boolean equals(Object object) { 97 return (super.equals (object) && 98 object instanceof JobMediaSheetsCompleted); 99 } 100 101 /** 102 * Get the printing attribute class which is to be used as the "category" 103 * for this printing attribute value. 104 * <P> 105 * For class JobMediaSheetsCompleted, the category is class 106 * JobMediaSheetsCompleted itself. 107 * 108 * @return Printing attribute class (category), an instance of class 109 * {@link java.lang.Class java.lang.Class}. 110 */ 111 public final Class<? extends Attribute> getCategory() { 112 return JobMediaSheetsCompleted.class; 113 } 114 115 /** 116 * Get the name of the category of which this attribute value is an 117 * instance. 118 * <P> 119 * For class JobMediaSheetsCompleted, the category name is 120 * {@code "job-media-sheets-completed"}. 121 * 122 * @return Attribute category name. 123 */ 124 public final String getName() { 125 return "job-media-sheets-completed"; 126 } 127 } | 1 /* 2 * Copyright (c) 2000, 2017, 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 23 * questions. 24 */ 25 26 package javax.print.attribute.standard; 27 28 import javax.print.attribute.Attribute; 29 import javax.print.attribute.IntegerSyntax; 30 import javax.print.attribute.PrintJobAttribute; 31 32 /** 33 * Class {@code JobMediaSheetsCompleted} is an integer valued printing attribute 34 * class that specifies the number of media sheets which have completed marking 35 * and stacking for the entire job so far, whether those sheets have been 36 * processed on one side or on both. 37 * <p> 38 * The {@code JobMediaSheetsCompleted} attribute describes the progress of the 39 * job. This attribute is intended to be a counter. That is, the 40 * {@code JobMediaSheetsCompleted} value for a job that has not started 41 * processing must be 0. When the job's {@link JobState JobState} is 42 * {@code PROCESSING} or {@code PROCESSING_STOPPED}, the 43 * {@code JobMediaSheetsCompleted} value is intended to increase as the job is 44 * processed; it indicates the amount of the job that has been processed at the 45 * time the Print Job's attribute set is queried or at the time a print job 46 * event is reported. When the job enters the {@code COMPLETED}, 47 * {@code CANCELED}, or {@code ABORTED} states, the 48 * {@code JobMediaSheetsCompleted} value is the final value for the job. 49 * <p> 50 * <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The 51 * category name returned by {@code getName()} gives the IPP attribute name. 52 * 53 * @author Alan Kaminsky 54 * @see JobMediaSheets 55 * @see JobMediaSheetsSupported 56 * @see JobKOctetsProcessed 57 * @see JobImpressionsCompleted 58 */ 59 public final class JobMediaSheetsCompleted extends IntegerSyntax 60 implements PrintJobAttribute { 61 62 /** 63 * Use serialVersionUID from JDK 1.4 for interoperability. 64 */ 65 private static final long serialVersionUID = 1739595973810840475L; 66 67 /** 68 * Construct a new job media sheets completed attribute with the given 69 * integer value. 70 * 71 * @param value Integer value 72 * @throws IllegalArgumentException if {@code value} is negative 73 */ 74 public JobMediaSheetsCompleted(int value) { 75 super (value, 0, Integer.MAX_VALUE); 76 } 77 78 /** 79 * Returns whether this job media sheets completed attribute is equivalent 80 * to the passed in object. To be equivalent, all of the following 81 * conditions must be true: 82 * <ol type=1> 83 * <li>{@code object} is not {@code null}. 84 * <li>{@code object} is an instance of class 85 * {@code JobMediaSheetsCompleted}. 86 * <li>This job media sheets completed attribute's value and 87 * {@code object}'s value are equal. 88 * </ol> 89 * 90 * @param object {@code Object} to compare to 91 * @return {@code true} if {@code object} is equivalent to this job media 92 * sheets completed attribute, {@code false} otherwise 93 */ 94 public boolean equals(Object object) { 95 return (super.equals (object) && 96 object instanceof JobMediaSheetsCompleted); 97 } 98 99 /** 100 * Get the printing attribute class which is to be used as the "category" 101 * for this printing attribute value. 102 * <p> 103 * For class {@code JobMediaSheetsCompleted}, the category is class 104 * {@code JobMediaSheetsCompleted} itself. 105 * 106 * @return printing attribute class (category), an instance of class 107 * {@link Class java.lang.Class} 108 */ 109 public final Class<? extends Attribute> getCategory() { 110 return JobMediaSheetsCompleted.class; 111 } 112 113 /** 114 * Get the name of the category of which this attribute value is an 115 * instance. 116 * <p> 117 * For class {@code JobMediaSheetsCompleted}, the category name is 118 * {@code "job-media-sheets-completed"}. 119 * 120 * @return attribute category name 121 */ 122 public final String getName() { 123 return "job-media-sheets-completed"; 124 } 125 } |