jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobImpressions.java
changeset 47196 a3211bb4daff
parent 35667 ed476aba94de
equal deleted inserted replaced
47195:b309b58eb190 47196:a3211bb4daff
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
     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.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    20  *
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    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
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    23  * questions.
    24  */
    24  */
       
    25 
    25 package javax.print.attribute.standard;
    26 package javax.print.attribute.standard;
    26 
    27 
    27 import javax.print.attribute.Attribute;
    28 import javax.print.attribute.Attribute;
    28 import javax.print.attribute.IntegerSyntax;
    29 import javax.print.attribute.IntegerSyntax;
       
    30 import javax.print.attribute.PrintJobAttribute;
    29 import javax.print.attribute.PrintRequestAttribute;
    31 import javax.print.attribute.PrintRequestAttribute;
    30 import javax.print.attribute.PrintJobAttribute;
       
    31 
    32 
    32 /**
    33 /**
    33  * Class JobImpressions is an integer valued printing attribute class that
    34  * Class {@code JobImpressions} is an integer valued printing attribute class
    34  * specifies the total size in number of impressions of the document(s) being
    35  * that specifies the total size in number of impressions of the document(s)
    35  * submitted. An "impression" is the image (possibly many print-stream pages in
    36  * being submitted. An "impression" is the image (possibly many print-stream
    36  * different configurations) imposed onto a single media page.
    37  * pages in different configurations) imposed onto a single media page.
    37  * <P>
    38  * <p>
    38  * The JobImpressions attribute describes the size of the job. This attribute is
    39  * The {@code JobImpressions} attribute describes the size of the job. This
    39  * not intended to be a counter; it is intended to be useful routing and
    40  * attribute is not intended to be a counter; it is intended to be useful
    40  * scheduling information if known. The printer may try to compute the
    41  * routing and scheduling information if known. The printer may try to compute
    41  * JobImpressions attribute's value if it is not supplied in the Print Request.
    42  * the {@code JobImpressions} attribute's value if it is not supplied in the
    42  * Even if the client does supply a value for the JobImpressions attribute in
    43  * Print Request. Even if the client does supply a value for the
    43  * the Print Request, the printer may choose to change the value if the printer
    44  * {@code JobImpressions} attribute in the Print Request, the printer may choose
    44  * is able to compute a value which is more accurate than the client supplied
    45  * to change the value if the printer is able to compute a value which is more
    45  * value. The printer may be able to determine the correct value for the
    46  * accurate than the client supplied value. The printer may be able to determine
    46  * JobImpressions attribute either right at job submission time or at any later
    47  * the correct value for the {@code JobImpressions} attribute either right at
    47  * point in time.
    48  * job submission time or at any later point in time.
    48  * <P>
    49  * <p>
    49  * As with {@link JobKOctets JobKOctets}, the JobImpressions value must not
    50  * As with {@link JobKOctets JobKOctets}, the {@code JobImpressions} value must
    50  * include the multiplicative factors contributed by the number of copies
    51  * not include the multiplicative factors contributed by the number of copies
    51  * specified by the {@link Copies Copies} attribute, independent of whether the
    52  * specified by the {@link Copies Copies} attribute, independent of whether the
    52  * device can process multiple copies without making multiple passes over the
    53  * device can process multiple copies without making multiple passes over the
    53  * job or document data and independent of whether the output is collated or
    54  * job or document data and independent of whether the output is collated or
    54  * not. Thus the value is independent of the implementation and reflects the
    55  * not. Thus the value is independent of the implementation and reflects the
    55  * size of the document(s) measured in impressions independent of the number of
    56  * size of the document(s) measured in impressions independent of the number of
    56  * copies.
    57  * copies.
    57  * <P>
    58  * <p>
    58  * As with {@link JobKOctets JobKOctets}, the JobImpressions value must also not
    59  * As with {@link JobKOctets JobKOctets}, the {@code JobImpressions} value must
    59  * include the multiplicative factor due to a copies instruction embedded in the
    60  * also not include the multiplicative factor due to a copies instruction
    60  * document data. If the document data actually includes replications of the
    61  * embedded in the document data. If the document data actually includes
    61  * document data, this value will include such replication. In other words, this
    62  * replications of the document data, this value will include such replication.
    62  * value is always the number of impressions in the source document data, rather
    63  * In other words, this value is always the number of impressions in the source
    63  * than a measure of the number of impressions to be produced by the job.
    64  * document data, rather than a measure of the number of impressions to be
    64  * <P>
    65  * produced by the job.
    65  * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
    66  * <p>
    66  * category name returned by {@code getName()} gives the IPP attribute
    67  * <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The
    67  * name.
    68  * category name returned by {@code getName()} gives the IPP attribute name.
    68  *
    69  *
       
    70  * @author Alan Kaminsky
    69  * @see JobImpressionsSupported
    71  * @see JobImpressionsSupported
    70  * @see JobImpressionsCompleted
    72  * @see JobImpressionsCompleted
    71  * @see JobKOctets
    73  * @see JobKOctets
    72  * @see JobMediaSheets
    74  * @see JobMediaSheets
    73  *
       
    74  * @author  Alan Kaminsky
       
    75  */
    75  */
    76 public final class JobImpressions extends IntegerSyntax
    76 public final class JobImpressions extends IntegerSyntax
    77     implements PrintRequestAttribute, PrintJobAttribute {
    77     implements PrintRequestAttribute, PrintJobAttribute {
    78 
    78 
       
    79     /**
       
    80      * Use serialVersionUID from JDK 1.4 for interoperability.
       
    81      */
    79     private static final long serialVersionUID = 8225537206784322464L;
    82     private static final long serialVersionUID = 8225537206784322464L;
    80 
       
    81 
    83 
    82     /**
    84     /**
    83      * Construct a new job impressions attribute with the given integer value.
    85      * Construct a new job impressions attribute with the given integer value.
    84      *
    86      *
    85      * @param  value  Integer value.
    87      * @param  value Integer value
       
    88      * @throws IllegalArgumentException if {@code value} is negative
    86      *
    89      *
    87      * @exception  IllegalArgumentException
       
    88      *  (Unchecked exception) Thrown if {@code value} is less than 0.
       
    89      */
    90      */
    90     public JobImpressions(int value) {
    91     public JobImpressions(int value) {
    91         super(value, 0, Integer.MAX_VALUE);
    92         super(value, 0, Integer.MAX_VALUE);
    92     }
    93     }
    93 
    94 
    94     /**
    95     /**
    95      * Returns whether this job impressions attribute is equivalent to the
    96      * Returns whether this job impressions attribute is equivalent to the
    96      * passed in object. To be equivalent, all of the following conditions must
    97      * passed in object. To be equivalent, all of the following conditions must
    97      * be true:
    98      * be true:
    98      * <OL TYPE=1>
    99      * <ol type=1>
    99      * <LI>
   100      *   <li>{@code object} is not {@code null}.
   100      * {@code object} is not null.
   101      *   <li>{@code object} is an instance of class {@code JobImpressions}.
   101      * <LI>
   102      *   <li>This job impressions attribute's value and {@code object}'s value
   102      * {@code object} is an instance of class JobImpressions.
   103      *   are equal.
   103      * <LI>
   104      * </ol>
   104      * This job impressions attribute's value and {@code object}'s value
       
   105      * are equal.
       
   106      * </OL>
       
   107      *
   105      *
   108      * @param  object  Object to compare to.
   106      * @param  object {@code Object} to compare to
   109      *
   107      * @return {@code true} if {@code object} is equivalent to this job
   110      * @return  True if {@code object} is equivalent to this job
   108      *         impressions attribute, {@code false} otherwise
   111      *          impressions attribute, false otherwise.
       
   112      */
   109      */
   113     public boolean equals(Object object) {
   110     public boolean equals(Object object) {
   114         return super.equals (object) && object instanceof JobImpressions;
   111         return super.equals (object) && object instanceof JobImpressions;
   115     }
   112     }
   116 
   113 
   117     /**
   114     /**
   118      * Get the printing attribute class which is to be used as the "category"
   115      * Get the printing attribute class which is to be used as the "category"
   119      * for this printing attribute value.
   116      * for this printing attribute value.
   120      * <P>
   117      * <p>
   121      * For class JobImpressions, the category is class JobImpressions itself.
   118      * For class {@code JobImpressions}, the category is class
       
   119      * {@code JobImpressions} itself.
   122      *
   120      *
   123      * @return  Printing attribute class (category), an instance of class
   121      * @return printing attribute class (category), an instance of class
   124      *          {@link java.lang.Class java.lang.Class}.
   122      *         {@link Class java.lang.Class}
   125      */
   123      */
   126     public final Class<? extends Attribute> getCategory() {
   124     public final Class<? extends Attribute> getCategory() {
   127         return JobImpressions.class;
   125         return JobImpressions.class;
   128     }
   126     }
   129 
   127 
   130     /**
   128     /**
   131      * Get the name of the category of which this attribute value is an
   129      * Get the name of the category of which this attribute value is an
   132      * instance.
   130      * instance.
   133      * <P>
   131      * <p>
   134      * For class JobImpressions, the category name is
   132      * For class {@code JobImpressions}, the category name is
   135      * {@code "job-impressions"}.
   133      * {@code "job-impressions"}.
   136      *
   134      *
   137      * @return  Attribute category name.
   135      * @return attribute category name
   138      */
   136      */
   139     public final String getName() {
   137     public final String getName() {
   140         return "job-impressions";
   138         return "job-impressions";
   141     }
   139     }
   142 
       
   143 }
   140 }