OSDN Git Service

5dfd17da42767adb0c71a5fec4e983718af42ac2
[dvibrowser/dvi2epub.git] / src / jp / sourceforge / dvibrowser / dvicore / MetafontMode.java
1 /*
2  * Copyright (c) 2009, Takeyuki Nagao
3  * All rights reserved.
4  * 
5  * Redistribution and use in source and binary forms, with or
6  * without modification, are permitted provided that the
7  * following conditions are met:
8  * 
9  *  * Redistributions of source code must retain the above
10  *    copyright notice, this list of conditions and the
11  *    following disclaimer.
12  *  * Redistributions in binary form must reproduce the above
13  *    copyright notice, this list of conditions and the
14  *    following disclaimer in the documentation and/or other
15  *    materials provided with the distribution.
16  *    
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
18  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
19  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
22  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
29  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
30  * OF SUCH DAMAGE.
31  */
32 package jp.sourceforge.dvibrowser.dvicore;
33
34 // TOOD: implement the default values.
35 public final class MetafontMode {
36   public static final MetafontMode FALLBACK_600DPI = new MetafontMode("ljfour", 600);
37   public static final MetafontMode FALLBACK_400DPI = new MetafontMode("agfatfzz", 400);
38   public static final MetafontMode FALLBACK = FALLBACK_600DPI;
39   private final String mode;
40   private final int bdpi;
41
42   public MetafontMode(String mode, int bdpi)
43   {
44     this.mode = mode;
45     this.bdpi = bdpi;
46   }
47
48   public String getMode() {
49     return mode;
50   }
51
52   public int getBdpi() {
53     return bdpi;
54   }
55   
56   public int hashCode()
57   {
58     return mode.hashCode() + 33 * bdpi;
59   }
60   
61   public boolean equals(Object o)
62   {
63     if (!(o instanceof MetafontMode)) {
64       return false;
65     }
66     MetafontMode mm = (MetafontMode) o;
67     return (mm.mode.equals(mode) && mm.bdpi == mm.bdpi);
68   }
69   
70   public String toString() {
71     return getClass().getName() + "[mode=" + mode + ",bdpi=" + bdpi + "]";
72   }
73 }