home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &n…he Search for Life DVD 2 / DVD-ROM.iso / install / jre1_3 / lib / rt.jar / java / awt / JobAttributes.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  6.8 KB  |  375 lines

  1. package java.awt;
  2.  
  3. public final class JobAttributes implements Cloneable {
  4.    private int copies;
  5.    private DefaultSelectionType defaultSelection;
  6.    private DestinationType destination;
  7.    private DialogType dialog;
  8.    private String fileName;
  9.    private int fromPage;
  10.    private int maxPage;
  11.    private int minPage;
  12.    private MultipleDocumentHandlingType multipleDocumentHandling;
  13.    private int[][] pageRanges;
  14.    private int prFirst;
  15.    private int prLast;
  16.    private String printer;
  17.    private SidesType sides;
  18.    private int toPage;
  19.  
  20.    public JobAttributes() {
  21.       this.setCopiesToDefault();
  22.       this.setDefaultSelection(java.awt.JobAttributes.DefaultSelectionType.ALL);
  23.       this.setDestination(java.awt.JobAttributes.DestinationType.PRINTER);
  24.       this.setDialog(java.awt.JobAttributes.DialogType.NATIVE);
  25.       this.setMaxPage(Integer.MAX_VALUE);
  26.       this.setMinPage(1);
  27.       this.setMultipleDocumentHandlingToDefault();
  28.       this.setSidesToDefault();
  29.    }
  30.  
  31.    public JobAttributes(JobAttributes var1) {
  32.       this.set(var1);
  33.    }
  34.  
  35.    public JobAttributes(int var1, DefaultSelectionType var2, DestinationType var3, DialogType var4, String var5, int var6, int var7, MultipleDocumentHandlingType var8, int[][] var9, String var10, SidesType var11) {
  36.       this.setCopies(var1);
  37.       this.setDefaultSelection(var2);
  38.       this.setDestination(var3);
  39.       this.setDialog(var4);
  40.       this.setFileName(var5);
  41.       this.setMaxPage(var6);
  42.       this.setMinPage(var7);
  43.       this.setMultipleDocumentHandling(var8);
  44.       this.setPageRanges(var9);
  45.       this.setPrinter(var10);
  46.       this.setSides(var11);
  47.    }
  48.  
  49.    public Object clone() {
  50.       try {
  51.          return super.clone();
  52.       } catch (CloneNotSupportedException var2) {
  53.          throw new InternalError();
  54.       }
  55.    }
  56.  
  57.    public void set(JobAttributes var1) {
  58.       this.copies = var1.copies;
  59.       this.defaultSelection = var1.defaultSelection;
  60.       this.destination = var1.destination;
  61.       this.dialog = var1.dialog;
  62.       this.fileName = var1.fileName;
  63.       this.fromPage = var1.fromPage;
  64.       this.maxPage = var1.maxPage;
  65.       this.minPage = var1.minPage;
  66.       this.multipleDocumentHandling = var1.multipleDocumentHandling;
  67.       this.pageRanges = var1.pageRanges;
  68.       this.prFirst = var1.prFirst;
  69.       this.prLast = var1.prLast;
  70.       this.printer = var1.printer;
  71.       this.sides = var1.sides;
  72.       this.toPage = var1.toPage;
  73.    }
  74.  
  75.    public int getCopies() {
  76.       return this.copies;
  77.    }
  78.  
  79.    public void setCopies(int var1) {
  80.       if (var1 <= 0) {
  81.          throw new IllegalArgumentException("Invalid value for attribute copies");
  82.       } else {
  83.          this.copies = var1;
  84.       }
  85.    }
  86.  
  87.    public void setCopiesToDefault() {
  88.       this.setCopies(1);
  89.    }
  90.  
  91.    public DefaultSelectionType getDefaultSelection() {
  92.       return this.defaultSelection;
  93.    }
  94.  
  95.    public void setDefaultSelection(DefaultSelectionType var1) {
  96.       if (var1 == null) {
  97.          throw new IllegalArgumentException("Invalid value for attribute defaultSelection");
  98.       } else {
  99.          this.defaultSelection = var1;
  100.       }
  101.    }
  102.  
  103.    public DestinationType getDestination() {
  104.       return this.destination;
  105.    }
  106.  
  107.    public void setDestination(DestinationType var1) {
  108.       if (var1 == null) {
  109.          throw new IllegalArgumentException("Invalid value for attribute destination");
  110.       } else {
  111.          this.destination = var1;
  112.       }
  113.    }
  114.  
  115.    public DialogType getDialog() {
  116.       return this.dialog;
  117.    }
  118.  
  119.    public void setDialog(DialogType var1) {
  120.       if (var1 == null) {
  121.          throw new IllegalArgumentException("Invalid value for attribute dialog");
  122.       } else {
  123.          this.dialog = var1;
  124.       }
  125.    }
  126.  
  127.    public String getFileName() {
  128.       return this.fileName;
  129.    }
  130.  
  131.    public void setFileName(String var1) {
  132.       this.fileName = var1;
  133.    }
  134.  
  135.    public int getFromPage() {
  136.       if (this.fromPage != 0) {
  137.          return this.fromPage;
  138.       } else if (this.toPage != 0) {
  139.          return this.getMinPage();
  140.       } else {
  141.          return this.pageRanges != null ? this.prFirst : this.getMinPage();
  142.       }
  143.    }
  144.  
  145.    public void setFromPage(int var1) {
  146.       if (var1 > 0 && (this.toPage == 0 || var1 <= this.toPage) && var1 >= this.minPage && var1 <= this.maxPage) {
  147.          this.fromPage = var1;
  148.       } else {
  149.          throw new IllegalArgumentException("Invalid value for attribute fromPage");
  150.       }
  151.    }
  152.  
  153.    public int getMaxPage() {
  154.       return this.maxPage;
  155.    }
  156.  
  157.    public void setMaxPage(int var1) {
  158.       if (var1 > 0 && var1 >= this.minPage) {
  159.          this.maxPage = var1;
  160.       } else {
  161.          throw new IllegalArgumentException("Invalid value for attribute maxPage");
  162.       }
  163.    }
  164.  
  165.    public int getMinPage() {
  166.       return this.minPage;
  167.    }
  168.  
  169.    public void setMinPage(int var1) {
  170.       if (var1 > 0 && var1 <= this.maxPage) {
  171.          this.minPage = var1;
  172.       } else {
  173.          throw new IllegalArgumentException("Invalid value for attribute minPage");
  174.       }
  175.    }
  176.  
  177.    public MultipleDocumentHandlingType getMultipleDocumentHandling() {
  178.       return this.multipleDocumentHandling;
  179.    }
  180.  
  181.    public void setMultipleDocumentHandling(MultipleDocumentHandlingType var1) {
  182.       if (var1 == null) {
  183.          throw new IllegalArgumentException("Invalid value for attribute multipleDocumentHandling");
  184.       } else {
  185.          this.multipleDocumentHandling = var1;
  186.       }
  187.    }
  188.  
  189.    public void setMultipleDocumentHandlingToDefault() {
  190.       this.setMultipleDocumentHandling(java.awt.JobAttributes.MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES);
  191.    }
  192.  
  193.    public int[][] getPageRanges() {
  194.       if (this.pageRanges == null) {
  195.          if (this.fromPage == 0 && this.toPage == 0) {
  196.             int var4 = this.getMinPage();
  197.             return new int[][]{{var4, var4}};
  198.          } else {
  199.             int var3 = this.getFromPage();
  200.             int var5 = this.getToPage();
  201.             return new int[][]{{var3, var5}};
  202.          }
  203.       } else {
  204.          int[][] var1 = new int[this.pageRanges.length][2];
  205.  
  206.          for(int var2 = 0; var2 < this.pageRanges.length; ++var2) {
  207.             var1[var2][0] = this.pageRanges[var2][0];
  208.             var1[var2][1] = this.pageRanges[var2][1];
  209.          }
  210.  
  211.          return var1;
  212.       }
  213.    }
  214.  
  215.    public void setPageRanges(int[][] var1) {
  216.       String var2 = "Invalid value for attribute pageRanges";
  217.       int var3 = 0;
  218.       int var4 = 0;
  219.       if (var1 == null) {
  220.          throw new IllegalArgumentException(var2);
  221.       } else {
  222.          for(int var5 = 0; var5 < var1.length; ++var5) {
  223.             if (var1[var5] == null || var1[var5].length != 2 || var1[var5][0] <= var4 || var1[var5][1] < var1[var5][0]) {
  224.                throw new IllegalArgumentException(var2);
  225.             }
  226.  
  227.             var4 = var1[var5][1];
  228.             if (var3 == 0) {
  229.                var3 = var1[var5][0];
  230.             }
  231.          }
  232.  
  233.          if (var3 >= this.minPage && var4 <= this.maxPage) {
  234.             int[][] var6 = new int[var1.length][2];
  235.  
  236.             for(int var7 = 0; var7 < var1.length; ++var7) {
  237.                var6[var7][0] = var1[var7][0];
  238.                var6[var7][1] = var1[var7][1];
  239.             }
  240.  
  241.             this.pageRanges = var6;
  242.             this.prFirst = var3;
  243.             this.prLast = var4;
  244.          } else {
  245.             throw new IllegalArgumentException(var2);
  246.          }
  247.       }
  248.    }
  249.  
  250.    public String getPrinter() {
  251.       return this.printer;
  252.    }
  253.  
  254.    public void setPrinter(String var1) {
  255.       this.printer = var1;
  256.    }
  257.  
  258.    public SidesType getSides() {
  259.       return this.sides;
  260.    }
  261.  
  262.    public void setSides(SidesType var1) {
  263.       if (var1 == null) {
  264.          throw new IllegalArgumentException("Invalid value for attribute sides");
  265.       } else {
  266.          this.sides = var1;
  267.       }
  268.    }
  269.  
  270.    public void setSidesToDefault() {
  271.       this.setSides(java.awt.JobAttributes.SidesType.ONE_SIDED);
  272.    }
  273.  
  274.    public int getToPage() {
  275.       if (this.toPage != 0) {
  276.          return this.toPage;
  277.       } else if (this.fromPage != 0) {
  278.          return this.fromPage;
  279.       } else {
  280.          return this.pageRanges != null ? this.prLast : this.getMinPage();
  281.       }
  282.    }
  283.  
  284.    public void setToPage(int var1) {
  285.       if (var1 > 0 && (this.fromPage == 0 || var1 >= this.fromPage) && var1 >= this.minPage && var1 <= this.maxPage) {
  286.          this.toPage = var1;
  287.       } else {
  288.          throw new IllegalArgumentException("Invalid value for attribute toPage");
  289.       }
  290.    }
  291.  
  292.    public boolean equals(Object var1) {
  293.       if (!(var1 instanceof JobAttributes)) {
  294.          return false;
  295.       } else {
  296.          JobAttributes var2 = (JobAttributes)var1;
  297.          if (this.fileName == null) {
  298.             if (var2.fileName != null) {
  299.                return false;
  300.             }
  301.          } else if (!this.fileName.equals(var2.fileName)) {
  302.             return false;
  303.          }
  304.  
  305.          if (this.pageRanges == null) {
  306.             if (var2.pageRanges != null) {
  307.                return false;
  308.             }
  309.          } else {
  310.             if (var2.pageRanges == null || this.pageRanges.length != var2.pageRanges.length) {
  311.                return false;
  312.             }
  313.  
  314.             for(int var3 = 0; var3 < this.pageRanges.length; ++var3) {
  315.                if (this.pageRanges[var3][0] != var2.pageRanges[var3][0] || this.pageRanges[var3][1] != var2.pageRanges[var3][1]) {
  316.                   return false;
  317.                }
  318.             }
  319.          }
  320.  
  321.          if (this.printer == null) {
  322.             if (var2.printer != null) {
  323.                return false;
  324.             }
  325.          } else if (!this.printer.equals(var2.printer)) {
  326.             return false;
  327.          }
  328.  
  329.          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;
  330.       }
  331.    }
  332.  
  333.    public int hashCode() {
  334.       int var1 = (this.copies + this.fromPage + this.maxPage + this.minPage + this.prFirst + this.prLast + this.toPage) * 31 << 21;
  335.       if (this.pageRanges != null) {
  336.          int var2 = 0;
  337.  
  338.          for(int var3 = 0; var3 < this.pageRanges.length; ++var3) {
  339.             var2 += this.pageRanges[var3][0] + this.pageRanges[var3][1];
  340.          }
  341.  
  342.          var1 ^= var2 * 31 << 11;
  343.       }
  344.  
  345.       if (this.fileName != null) {
  346.          var1 ^= this.fileName.hashCode();
  347.       }
  348.  
  349.       if (this.printer != null) {
  350.          var1 ^= this.printer.hashCode();
  351.       }
  352.  
  353.       return this.defaultSelection.hashCode() << 6 ^ this.destination.hashCode() << 5 ^ this.dialog.hashCode() << 3 ^ this.multipleDocumentHandling.hashCode() << 2 ^ this.sides.hashCode() ^ var1;
  354.    }
  355.  
  356.    public String toString() {
  357.       int[][] var1 = this.getPageRanges();
  358.       String var2 = "[";
  359.       boolean var3 = true;
  360.  
  361.       for(int var4 = 0; var4 < var1.length; ++var4) {
  362.          if (var3) {
  363.             var3 = false;
  364.          } else {
  365.             var2 = var2 + ",";
  366.          }
  367.  
  368.          var2 = var2 + var1[var4][0] + ":" + var1[var4][1];
  369.       }
  370.  
  371.       var2 = var2 + "]";
  372.       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();
  373.    }
  374. }
  375.