net.sourceforge.barbecue.linear.upc
Class ModuleFactory

java.lang.Object
  extended bynet.sourceforge.barbecue.linear.upc.ModuleFactory

public class ModuleFactory
extends java.lang.Object

The UPC-A barcode module definitions.

Author:
James Jenner

Field Summary
static Module CENTRE_GUARD
           
static int GUARD_CHAR_SIZE
           
protected static java.util.List KEYS_LEFT
           
protected static java.util.List KEYS_RIGHT
           
static Module LEFT_GUARD
          The guards for the barcode
static Module LEFT_MARGIN
           
static int LEFT_WIDTH
           
static Module RIGHT_GUARD
           
static Module RIGHT_MARGIN
           
protected static java.util.Map SET_LEFT
           
protected static java.util.Map SET_RIGHT
           
 
Constructor Summary
protected ModuleFactory()
          Cannot construct.
 
Method Summary
static Module getModule(java.lang.String key, int position)
          Returns the module that represents the specified character.
static Module getModuleForIndex(int index)
          Returns the encoded module at the given index position.
static boolean hasModule(java.lang.String key)
          Indicates whether the given key is represented in the default encoding table that this module factory contains.
protected static void initBaseSet()
          Initialise the module definitions.
protected static void initLeftSet()
           
protected static void initRightSet()
           
static boolean isValid(java.lang.String key)
          Indicates whether the given character is valid for this barcode or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFT_GUARD

public static final Module LEFT_GUARD
The guards for the barcode


CENTRE_GUARD

public static final Module CENTRE_GUARD

RIGHT_GUARD

public static final Module RIGHT_GUARD

LEFT_MARGIN

public static final Module LEFT_MARGIN

RIGHT_MARGIN

public static final Module RIGHT_MARGIN

KEYS_LEFT

protected static final java.util.List KEYS_LEFT

KEYS_RIGHT

protected static final java.util.List KEYS_RIGHT

SET_LEFT

protected static final java.util.Map SET_LEFT

SET_RIGHT

protected static final java.util.Map SET_RIGHT

LEFT_WIDTH

public static final int LEFT_WIDTH
See Also:
Constant Field Values

GUARD_CHAR_SIZE

public static final int GUARD_CHAR_SIZE
See Also:
Constant Field Values
Constructor Detail

ModuleFactory

protected ModuleFactory()
Cannot construct.

Method Detail

initBaseSet

protected static void initBaseSet()
Initialise the module definitions.


initRightSet

protected static void initRightSet()

initLeftSet

protected static void initLeftSet()

getModule

public static Module getModule(java.lang.String key,
                               int position)
Returns the module that represents the specified character.

Parameters:
key - The data character to get the encoding module for
position - The position of the data character, starts at 0
Returns:
The module that encodes the given char

hasModule

public static boolean hasModule(java.lang.String key)
Indicates whether the given key is represented in the default encoding table that this module factory contains.

Returns:
True if the key has a direct module encoding, false if not

getModuleForIndex

public static Module getModuleForIndex(int index)
Returns the encoded module at the given index position. This is used to get the encoded checksum character.

Parameters:
index - The index of the module required
Returns:
The module at the specified index

isValid

public static boolean isValid(java.lang.String key)
Indicates whether the given character is valid for this barcode or not. This basically just checks to see whether the key is in the list of encoded characters.

Parameters:
key - The key to check for validity
Returns:
True if the key is valid, false otherwise


Copyright © 2003-2007 barbecue.sourceforge.net. All Rights Reserved.