001 /**
002 * This library is free software; you can redistribute it and/or modify it
003 * under the terms of the GNU Lesser General Public License (LGPL) as
004 * published by the Free Software Foundation; either version 3.0 of the
005 * License, or (at your option) any later version.
006 *
007 * This library is distributed in the hope that it will be useful, but
008 * WITHOUT ANY WARRANTY; without even the implied warranty of
009 * MERCHANTABILITY of FITNESS FOR A PARTICULAR PURPOSE. See the GNU
010 * Lesser General Public License for more details.
011 */
012
013 /**
014 * Title: JBarcodeBean
015 * Description: Barcode JavaBeans Component
016 * Copyright: Copyright (C) 2004
017 * Company: Dafydd Walters
018 */
019 package net.sourceforge.jbarcodebean.model;
020
021 /**
022 * This class, which implements the {@link BarcodeStrategy} interface,
023 * knows how to encode the 2:1 (narrow)
024 * variant of the Interleaved Code 2 of 5 barcode type.
025 */
026 public class Interleaved25_2to1 extends Interleaved25 implements java.io.Serializable {
027
028 private static CharacterCode[] codes = {
029 new CharacterCode('1', new byte[] {2,1,1,1,2}, 1),
030 new CharacterCode('2', new byte[] {1,2,1,1,2}, 2),
031 new CharacterCode('3', new byte[] {2,2,1,1,1}, 3),
032 new CharacterCode('4', new byte[] {1,1,2,1,2}, 4),
033 new CharacterCode('5', new byte[] {2,1,2,1,1}, 5),
034 new CharacterCode('6', new byte[] {1,2,2,1,1}, 6),
035 new CharacterCode('7', new byte[] {1,1,1,2,2}, 7),
036 new CharacterCode('8', new byte[] {2,1,1,2,1}, 8),
037 new CharacterCode('9', new byte[] {1,2,1,2,1}, 9),
038 new CharacterCode('0', new byte[] {1,1,2,2,1}, 0),
039 new CharacterCode('A', new byte[] {1,1,1,1}, -1), // Start
040 new CharacterCode('B', new byte[] {2,1,1}, -1) // Stop
041 };
042
043 /**
044 * This implementation of <tt>getCodes</tt> returns an array of
045 * {@link AbstractBarcodeStrategy.CharacterCode CharacterCode} objects
046 * for the narrow Interleaved Code25 format.
047 */
048 protected CharacterCode[] getCodes() {
049 return Interleaved25_2to1.codes;
050 }
051 }