home *** CD-ROM | disk | FTP | other *** search
- package java.awt;
-
- public final class JobAttributes implements Cloneable {
- private int copies;
- private DefaultSelectionType defaultSelection;
- private DestinationType destination;
- private DialogType dialog;
- private String fileName;
- private int fromPage;
- private int maxPage;
- private int minPage;
- private MultipleDocumentHandlingType multipleDocumentHandling;
- private int[][] pageRanges;
- private int prFirst;
- private int prLast;
- private String printer;
- private SidesType sides;
- private int toPage;
-
- public JobAttributes() {
- this.setCopiesToDefault();
- this.setDefaultSelection(java.awt.JobAttributes.DefaultSelectionType.ALL);
- this.setDestination(java.awt.JobAttributes.DestinationType.PRINTER);
- this.setDialog(java.awt.JobAttributes.DialogType.NATIVE);
- this.setMaxPage(Integer.MAX_VALUE);
- this.setMinPage(1);
- this.setMultipleDocumentHandlingToDefault();
- this.setSidesToDefault();
- }
-
- public JobAttributes(JobAttributes var1) {
- this.set(var1);
- }
-
- public JobAttributes(int var1, DefaultSelectionType var2, DestinationType var3, DialogType var4, String var5, int var6, int var7, MultipleDocumentHandlingType var8, int[][] var9, String var10, SidesType var11) {
- this.setCopies(var1);
- this.setDefaultSelection(var2);
- this.setDestination(var3);
- this.setDialog(var4);
- this.setFileName(var5);
- this.setMaxPage(var6);
- this.setMinPage(var7);
- this.setMultipleDocumentHandling(var8);
- this.setPageRanges(var9);
- this.setPrinter(var10);
- this.setSides(var11);
- }
-
- public Object clone() {
- try {
- return super.clone();
- } catch (CloneNotSupportedException var2) {
- throw new InternalError();
- }
- }
-
- public void set(JobAttributes var1) {
- this.copies = var1.copies;
- this.defaultSelection = var1.defaultSelection;
- this.destination = var1.destination;
- this.dialog = var1.dialog;
- this.fileName = var1.fileName;
- this.fromPage = var1.fromPage;
- this.maxPage = var1.maxPage;
- this.minPage = var1.minPage;
- this.multipleDocumentHandling = var1.multipleDocumentHandling;
- this.pageRanges = var1.pageRanges;
- this.prFirst = var1.prFirst;
- this.prLast = var1.prLast;
- this.printer = var1.printer;
- this.sides = var1.sides;
- this.toPage = var1.toPage;
- }
-
- public int getCopies() {
- return this.copies;
- }
-
- public void setCopies(int var1) {
- if (var1 <= 0) {
- throw new IllegalArgumentException("Invalid value for attribute copies");
- } else {
- this.copies = var1;
- }
- }
-
- public void setCopiesToDefault() {
- this.setCopies(1);
- }
-
- public DefaultSelectionType getDefaultSelection() {
- return this.defaultSelection;
- }
-
- public void setDefaultSelection(DefaultSelectionType var1) {
- if (var1 == null) {
- throw new IllegalArgumentException("Invalid value for attribute defaultSelection");
- } else {
- this.defaultSelection = var1;
- }
- }
-
- public DestinationType getDestination() {
- return this.destination;
- }
-
- public void setDestination(DestinationType var1) {
- if (var1 == null) {
- throw new IllegalArgumentException("Invalid value for attribute destination");
- } else {
- this.destination = var1;
- }
- }
-
- public DialogType getDialog() {
- return this.dialog;
- }
-
- public void setDialog(DialogType var1) {
- if (var1 == null) {
- throw new IllegalArgumentException("Invalid value for attribute dialog");
- } else {
- this.dialog = var1;
- }
- }
-
- public String getFileName() {
- return this.fileName;
- }
-
- public void setFileName(String var1) {
- this.fileName = var1;
- }
-
- public int getFromPage() {
- if (this.fromPage != 0) {
- return this.fromPage;
- } else if (this.toPage != 0) {
- return this.getMinPage();
- } else {
- return this.pageRanges != null ? this.prFirst : this.getMinPage();
- }
- }
-
- public void setFromPage(int var1) {
- if (var1 > 0 && (this.toPage == 0 || var1 <= this.toPage) && var1 >= this.minPage && var1 <= this.maxPage) {
- this.fromPage = var1;
- } else {
- throw new IllegalArgumentException("Invalid value for attribute fromPage");
- }
- }
-
- public int getMaxPage() {
- return this.maxPage;
- }
-
- public void setMaxPage(int var1) {
- if (var1 > 0 && var1 >= this.minPage) {
- this.maxPage = var1;
- } else {
- throw new IllegalArgumentException("Invalid value for attribute maxPage");
- }
- }
-
- public int getMinPage() {
- return this.minPage;
- }
-
- public void setMinPage(int var1) {
- if (var1 > 0 && var1 <= this.maxPage) {
- this.minPage = var1;
- } else {
- throw new IllegalArgumentException("Invalid value for attribute minPage");
- }
- }
-
- public MultipleDocumentHandlingType getMultipleDocumentHandling() {
- return this.multipleDocumentHandling;
- }
-
- public void setMultipleDocumentHandling(MultipleDocumentHandlingType var1) {
- if (var1 == null) {
- throw new IllegalArgumentException("Invalid value for attribute multipleDocumentHandling");
- } else {
- this.multipleDocumentHandling = var1;
- }
- }
-
- public void setMultipleDocumentHandlingToDefault() {
- this.setMultipleDocumentHandling(java.awt.JobAttributes.MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES);
- }
-
- public int[][] getPageRanges() {
- if (this.pageRanges == null) {
- if (this.fromPage == 0 && this.toPage == 0) {
- int var4 = this.getMinPage();
- return new int[][]{{var4, var4}};
- } else {
- int var3 = this.getFromPage();
- int var5 = this.getToPage();
- return new int[][]{{var3, var5}};
- }
- } else {
- int[][] var1 = new int[this.pageRanges.length][2];
-
- for(int var2 = 0; var2 < this.pageRanges.length; ++var2) {
- var1[var2][0] = this.pageRanges[var2][0];
- var1[var2][1] = this.pageRanges[var2][1];
- }
-
- return var1;
- }
- }
-
- public void setPageRanges(int[][] var1) {
- String var2 = "Invalid value for attribute pageRanges";
- int var3 = 0;
- int var4 = 0;
- if (var1 == null) {
- throw new IllegalArgumentException(var2);
- } else {
- for(int var5 = 0; var5 < var1.length; ++var5) {
- if (var1[var5] == null || var1[var5].length != 2 || var1[var5][0] <= var4 || var1[var5][1] < var1[var5][0]) {
- throw new IllegalArgumentException(var2);
- }
-
- var4 = var1[var5][1];
- if (var3 == 0) {
- var3 = var1[var5][0];
- }
- }
-
- if (var3 >= this.minPage && var4 <= this.maxPage) {
- int[][] var6 = new int[var1.length][2];
-
- for(int var7 = 0; var7 < var1.length; ++var7) {
- var6[var7][0] = var1[var7][0];
- var6[var7][1] = var1[var7][1];
- }
-
- this.pageRanges = var6;
- this.prFirst = var3;
- this.prLast = var4;
- } else {
- throw new IllegalArgumentException(var2);
- }
- }
- }
-
- public String getPrinter() {
- return this.printer;
- }
-
- public void setPrinter(String var1) {
- this.printer = var1;
- }
-
- public SidesType getSides() {
- return this.sides;
- }
-
- public void setSides(SidesType var1) {
- if (var1 == null) {
- throw new IllegalArgumentException("Invalid value for attribute sides");
- } else {
- this.sides = var1;
- }
- }
-
- public void setSidesToDefault() {
- this.setSides(java.awt.JobAttributes.SidesType.ONE_SIDED);
- }
-
- public int getToPage() {
- if (this.toPage != 0) {
- return this.toPage;
- } else if (this.fromPage != 0) {
- return this.fromPage;
- } else {
- return this.pageRanges != null ? this.prLast : this.getMinPage();
- }
- }
-
- public void setToPage(int var1) {
- if (var1 > 0 && (this.fromPage == 0 || var1 >= this.fromPage) && var1 >= this.minPage && var1 <= this.maxPage) {
- this.toPage = var1;
- } else {
- throw new IllegalArgumentException("Invalid value for attribute toPage");
- }
- }
-
- public boolean equals(Object var1) {
- if (!(var1 instanceof JobAttributes)) {
- return false;
- } else {
- JobAttributes var2 = (JobAttributes)var1;
- if (this.fileName == null) {
- if (var2.fileName != null) {
- return false;
- }
- } else if (!this.fileName.equals(var2.fileName)) {
- return false;
- }
-
- if (this.pageRanges == null) {
- if (var2.pageRanges != null) {
- return false;
- }
- } else {
- if (var2.pageRanges == null || this.pageRanges.length != var2.pageRanges.length) {
- return false;
- }
-
- for(int var3 = 0; var3 < this.pageRanges.length; ++var3) {
- if (this.pageRanges[var3][0] != var2.pageRanges[var3][0] || this.pageRanges[var3][1] != var2.pageRanges[var3][1]) {
- return false;
- }
- }
- }
-
- if (this.printer == null) {
- if (var2.printer != null) {
- return false;
- }
- } else if (!this.printer.equals(var2.printer)) {
- return false;
- }
-
- return this.copies == var2.copies && this.defaultSelection == var2.defaultSelection && this.destination == var2.destination && this.dialog == var2.dialog && this.fromPage == var2.fromPage && this.maxPage == var2.maxPage && this.minPage == var2.minPage && this.multipleDocumentHandling == var2.multipleDocumentHandling && this.prFirst == var2.prFirst && this.prLast == var2.prLast && this.sides == var2.sides && this.toPage == var2.toPage;
- }
- }
-
- public int hashCode() {
- int var1 = (this.copies + this.fromPage + this.maxPage + this.minPage + this.prFirst + this.prLast + this.toPage) * 31 << 21;
- if (this.pageRanges != null) {
- int var2 = 0;
-
- for(int var3 = 0; var3 < this.pageRanges.length; ++var3) {
- var2 += this.pageRanges[var3][0] + this.pageRanges[var3][1];
- }
-
- var1 ^= var2 * 31 << 11;
- }
-
- if (this.fileName != null) {
- var1 ^= this.fileName.hashCode();
- }
-
- if (this.printer != null) {
- var1 ^= this.printer.hashCode();
- }
-
- return this.defaultSelection.hashCode() << 6 ^ this.destination.hashCode() << 5 ^ this.dialog.hashCode() << 3 ^ this.multipleDocumentHandling.hashCode() << 2 ^ this.sides.hashCode() ^ var1;
- }
-
- public String toString() {
- int[][] var1 = this.getPageRanges();
- String var2 = "[";
- boolean var3 = true;
-
- for(int var4 = 0; var4 < var1.length; ++var4) {
- if (var3) {
- var3 = false;
- } else {
- var2 = var2 + ",";
- }
-
- var2 = var2 + var1[var4][0] + ":" + var1[var4][1];
- }
-
- var2 = var2 + "]";
- return "copies=" + this.getCopies() + ",defaultSelection=" + this.getDefaultSelection() + ",destination=" + this.getDestination() + ",dialog=" + this.getDialog() + ",fileName=" + this.getFileName() + ",fromPage=" + this.getFromPage() + ",maxPage=" + this.getMaxPage() + ",minPage=" + this.getMinPage() + ",multiple-document-handling=" + this.getMultipleDocumentHandling() + ",page-ranges=" + var2 + ",printer=" + this.getPrinter() + ",sides=" + this.getSides() + ",toPage=" + this.getToPage();
- }
- }
-