Original 2.4
[marc4j.git] / src / org / marc4j / converter / impl / CodeTableTracker.java
1 // $Id: CodeTableTracker.java,v 1.1 2005/05/04 10:06:46 bpeters Exp $\r
2 /**\r
3  * Copyright (C) 2002 Bas Peters (mail@bpeters.com)\r
4  *\r
5  * This file is part of MARC4J\r
6  *\r
7  * MARC4J is free software; you can redistribute it and/or\r
8  * modify it under the terms of the GNU Lesser General Public\r
9  * License as published by the Free Software Foundation; either\r
10  * version 2.1 of the License, or (at your option) any later version.\r
11  *\r
12  * MARC4J is distributed in the hope that it will be useful,\r
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
15  * Lesser General Public License for more details.\r
16  *\r
17  * You should have received a copy of the GNU Lesser General Public\r
18  * License along with MARC4J; if not, write to the Free Software\r
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
20  */\r
21 package org.marc4j.converter.impl;\r
22 \r
23 /**\r
24  * <p>A utility to convert UCS/Unicode data to MARC-8.</p>\r
25  *\r
26  * @author Corey Keith\r
27  * @version $Revision: 1.1 $\r
28  */\r
29 public class CodeTableTracker {\r
30     static final byte prev=0;\r
31     static final byte curr=1;\r
32     static final byte next=2;\r
33     static final byte G0=0;\r
34     static final byte G1=1;\r
35 \r
36     protected Integer g[][];\r
37 \r
38     public CodeTableTracker() {\r
39         g = new Integer[2][3];\r
40         g[G0][prev] = new Integer(0x42);\r
41         g[G1][prev] = new Integer(0x45);\r
42     }\r
43 \r
44     public void makePreviousCurrent() {\r
45         g[G0][curr] = g[G0][prev];\r
46         g[G1][curr] = g[G1][prev];\r
47     }\r
48 \r
49     public Integer getPrevious(byte set) {\r
50         return g[set][prev];\r
51     }\r
52 \r
53     public Integer getCurrent(byte set) {\r
54         return g[set][curr];\r
55     }\r
56 \r
57     public Integer getNext(byte set) {\r
58         return g[set][next];\r
59     }\r
60 \r
61     public void setPrevious(byte set, Integer table) {\r
62         g[set][prev]=table;\r
63     }\r
64 \r
65     public void setCurrent(byte set, Integer table) {\r
66         g[set][curr]=table;\r
67     }\r
68 \r
69     public void setNext(byte set, Integer table) {\r
70         g[set][next]=table;\r
71     }\r
72 \r
73     /* public String toString() {\r
74         return "G0: [" + Integer.toHexString(g[G0][prev]) + ", " + Integer.toHexString(g[G0][curr]) + ", "+ Integer.toHexString(g[G0][next]) + "]\n" +\r
75 "G1: ["+ Integer.toHexString(g[G1][prev]) + ", " + Integer.toHexString(g[G1][curr]) + ", "+ Integer.toHexString(g[G1][next]) + "]\n";\r
76 \r
77 \r
78     }\r
79     */\r
80 }\r