Initial import.
[clinton/mirror/jspi/.git] / jspi / src / main / java / de / lohndirekt / print / attribute / cups / PrinterType.java
diff --git a/jspi/src/main/java/de/lohndirekt/print/attribute/cups/PrinterType.java b/jspi/src/main/java/de/lohndirekt/print/attribute/cups/PrinterType.java
new file mode 100644 (file)
index 0000000..a31a4d7
--- /dev/null
@@ -0,0 +1,141 @@
+/**\r
+ * Copyright (C) 2003 <a href="http://www.lohndirekt.de/">lohndirekt.de</a>\r
+ *\r
+ * This library is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU Lesser General Public\r
+ * License as published by the Free Software Foundation; either\r
+ * version 2.1 of the License, or (at your option) any later version.\r
+ * \r
+ * This library is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
+ * Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *  \r
+ */\r
+package de.lohndirekt.print.attribute.cups;\r
+\r
+import javax.print.attribute.IntegerSyntax;\r
+import javax.print.attribute.PrintServiceAttribute;\r
+\r
+public class PrinterType extends IntegerSyntax implements PrintServiceAttribute {\r
+\r
+    public static final int IS_PRINTER_CLASS = 1 << 0;\r
+    public static final int IS_REMOTE_DESTINATION = 1 << 1;\r
+    public static final int CAN_BLACK = 1 << 2;\r
+    public static final int CAN_COLOR = 1 << 3;\r
+    public static final int CAN_DUPLEX = 1 << 4;\r
+    public static final int CAN_STAPLE = 1 << 5;\r
+    public static final int CAN_UNCOLLATED = 1 << 6;\r
+    public static final int CAN_COLLATED = 1 << 7;\r
+    public static final int CAN_PUNCH = 1 << 8;\r
+    public static final int CAN_COVER = 1 << 9;\r
+    public static final int CAN_BIND = 1 << 10;\r
+    public static final int CAN_SORT = 1 << 11;\r
+    public static final int CAN_A4 = 1 << 12;\r
+    public static final int CAN_A2 = 1 << 13;\r
+    public static final int CAN_LARGER_A2 = 1 << 14;\r
+    public static final int CAN_USER_DEFINED_MEDIA_SIZE = 1 << 15;\r
+    public static final int IS_IMPLICIT_CLASS = 1 << 16;\r
+\r
+    public boolean isPrinterClass() {\r
+        return (getValue() & IS_PRINTER_CLASS) == 1;\r
+    }\r
+\r
+    public boolean isRemoteDestination() {\r
+        return (getValue() & IS_REMOTE_DESTINATION) == 1;\r
+    }\r
+\r
+    public boolean canPrintBlack() {\r
+        return (getValue() & CAN_BLACK) == 1;\r
+    }\r
+\r
+    public boolean canPrintColor() {\r
+        return (getValue() & CAN_COLOR) == 1;\r
+    }\r
+\r
+    public boolean canDuplex() {\r
+        return (getValue() & CAN_DUPLEX) == 1;\r
+    }\r
+\r
+    public boolean canStaple() {\r
+        return (getValue() & CAN_STAPLE) == 1;\r
+    }\r
+\r
+    public boolean canUncollated() {\r
+        return (getValue() & CAN_UNCOLLATED) == 1;\r
+    }\r
+\r
+    public boolean canCollated() {\r
+        return (getValue() & CAN_COLLATED) == 1;\r
+    }\r
+\r
+    public boolean canPunch() {\r
+        return (getValue() & CAN_PUNCH) == 1;\r
+    }\r
+    \r
+    public boolean canCover() {\r
+        return (getValue() & CAN_COVER) == 1;\r
+    }\r
+    \r
+    public boolean canBind() {\r
+        return (getValue() & CAN_BIND) == 1;\r
+    }\r
+    \r
+    public boolean canSort() {\r
+        return (getValue() & CAN_SORT) == 1;\r
+    }\r
+    \r
+    public boolean canA4() {\r
+        return (getValue() & CAN_A4) == 1;\r
+    }\r
+    \r
+    public boolean canA2() {\r
+        return (getValue() & CAN_A2) == 1;\r
+    }\r
+    public boolean canLargerA2() {\r
+        return (getValue() & CAN_LARGER_A2) == 1;\r
+    }\r
+    \r
+    public boolean canUserDefinedMediaSize() {\r
+        return (getValue() & CAN_USER_DEFINED_MEDIA_SIZE) == 1;\r
+    }\r
+    public boolean isImplicitClass() {\r
+        return (getValue() & IS_IMPLICIT_CLASS) == 1;\r
+    }\r
+\r
+    \r
+    /**\r
+     * @param value\r
+     */\r
+    public PrinterType(int value) {\r
+        super(value);\r
+    }\r
+\r
+    /**\r
+     *\r
+     */\r
+\r
+    public Class getCategory() {\r
+        return this.getClass();\r
+    }\r
+\r
+    /**\r
+     *\r
+     */\r
+\r
+    public String getName() {\r
+        return PrinterType.getIppName();\r
+    }\r
+\r
+    /**\r
+     * \r
+     */\r
+    public static final String getIppName() {\r
+        return "printer-type";\r
+    }\r
+\r
+}\r