Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.desktop/share/classes/javax/print/attribute/standard/DateTimeAtCompleted.java
41171 views
1
/*
2
* Copyright (c) 2000, 2021, 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 java.io.Serial;
29
import java.util.Calendar;
30
import java.util.Date;
31
32
import javax.print.attribute.Attribute;
33
import javax.print.attribute.DateTimeSyntax;
34
import javax.print.attribute.PrintJobAttribute;
35
36
/**
37
* Class {@code DateTimeAtCompleted} is a printing attribute class, a date-time
38
* attribute, that indicates the date and time at which the Print Job completed
39
* (or was canceled or aborted).
40
* <p>
41
* To construct a {@code DateTimeAtCompleted} attribute from separate values of
42
* the year, month, day, hour, minute, and so on, use a
43
* {@link Calendar Calendar} object to construct a {@link Date Date} object,
44
* then use the {@link Date Date} object to construct the DateTimeAtCompleted
45
* attribute. To convert a {@code DateTimeAtCompleted} attribute to separate
46
* values of the year, month, day, hour, minute, and so on, create a
47
* {@link Calendar Calendar} object and set it to the {@link Date Date} from the
48
* {@code DateTimeAtCompleted} attribute.
49
* <p>
50
* <b>IPP Compatibility:</b> The information needed to construct an IPP
51
* "date-time-at-completed" attribute can be obtained as described above. The
52
* category name returned by {@code getName()} gives the IPP attribute name.
53
*
54
* @author Alan Kaminsky
55
*/
56
public final class DateTimeAtCompleted extends DateTimeSyntax
57
implements PrintJobAttribute {
58
59
/**
60
* Use serialVersionUID from JDK 1.4 for interoperability.
61
*/
62
@Serial
63
private static final long serialVersionUID = 6497399708058490000L;
64
65
/**
66
* Construct a new date-time at completed attribute with the given
67
* {@link Date Date} value.
68
*
69
* @param dateTime {@link Date Date} value
70
* @throws NullPointerException if {@code dateTime} is {@code null}
71
*/
72
public DateTimeAtCompleted(Date dateTime) {
73
super (dateTime);
74
}
75
76
/**
77
* Returns whether this date-time at completed attribute is equivalent to
78
* the passed in object. To be equivalent, all of the following conditions
79
* must be true:
80
* <ol type=1>
81
* <li>{@code object} is not {@code null}.
82
* <li>{@code object} is an instance of class {@code DateTimeAtCompleted}.
83
* <li>This date-time at completed attribute's {@link Date Date}
84
* value and {@code object}'s {@link Date Date} value are equal.
85
* </ol>
86
*
87
* @param object {@code Object} to compare to
88
* @return {@code true} if {@code object} is equivalent to this date-time at
89
* completed attribute, {@code false} otherwise
90
*/
91
public boolean equals(Object object) {
92
return(super.equals (object) &&
93
object instanceof DateTimeAtCompleted);
94
}
95
96
// Exported operations inherited and implemented from interface Attribute.
97
98
/**
99
* Get the printing attribute class which is to be used as the "category"
100
* for this printing attribute value.
101
* <p>
102
* For class {@code DateTimeAtCompleted}, the category is class
103
* {@code DateTimeAtCompleted} itself.
104
*
105
* @return printing attribute class (category), an instance of class
106
* {@link Class java.lang.Class}
107
*/
108
public final Class<? extends Attribute> getCategory() {
109
return DateTimeAtCompleted.class;
110
}
111
112
/**
113
* Get the name of the category of which this attribute value is an
114
* instance.
115
* <p>
116
* For class {@code DateTimeAtCompleted}, the category name is
117
* {@code "date-time-at-completed"}.
118
*
119
* @return attribute category name
120
*/
121
public final String getName() {
122
return "date-time-at-completed";
123
}
124
}
125
126