1 // $Id: CodeTableTracker.java,v 1.1 2005/05/04 10:06:46 bpeters Exp $
\r
3 * Copyright (C) 2002 Bas Peters (mail@bpeters.com)
\r
5 * This file is part of MARC4J
\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
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
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
21 package org.marc4j.converter.impl;
\r
24 * <p>A utility to convert UCS/Unicode data to MARC-8.</p>
\r
26 * @author Corey Keith
\r
27 * @version $Revision: 1.1 $
\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
36 protected Integer g[][];
\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
44 public void makePreviousCurrent() {
\r
45 g[G0][curr] = g[G0][prev];
\r
46 g[G1][curr] = g[G1][prev];
\r
49 public Integer getPrevious(byte set) {
\r
50 return g[set][prev];
\r
53 public Integer getCurrent(byte set) {
\r
54 return g[set][curr];
\r
57 public Integer getNext(byte set) {
\r
58 return g[set][next];
\r
61 public void setPrevious(byte set, Integer table) {
\r
65 public void setCurrent(byte set, Integer table) {
\r
69 public void setNext(byte set, Integer table) {
\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