barcode4j 2.1.0

org.krysalis.barcode4j.impl.fourstate
Class AbstractFourStateLogicImpl

java.lang.Object
  extended by org.krysalis.barcode4j.impl.fourstate.AbstractFourStateLogicImpl
Direct Known Subclasses:
AbstractRMCBCKIXLogicImpl, USPSIntelligentMailLogicImpl

public abstract class AbstractFourStateLogicImpl
extends java.lang.Object

Provides a base class for "four-state" barcodes.

Version:
$Id: AbstractFourStateLogicImpl.java,v 1.2 2008/05/13 13:00:43 jmaerki Exp $
Author:
Jeremias Maerki

Constructor Summary
AbstractFourStateLogicImpl(ChecksumMode mode)
          Main constructor
 
Method Summary
abstract  char calcChecksum(java.lang.String msg)
          Calculates the checksum for a message to be encoded as an one of the foru-state barcode symbologies.
protected  void encodeCodeword(ClassicBarcodeLogicHandler logic, char c, java.lang.String codeword)
          Encodes a single character.
protected abstract  java.lang.String[] encodeHighLevel(java.lang.String msg)
          Does the high-level encoding of the message into codewords.
 void generateBarcodeLogic(ClassicBarcodeLogicHandler logic, java.lang.String msg)
          Generates the barcode logic
 ChecksumMode getChecksumMode()
          Returns the currently active checksum mode.
static boolean isIgnoredChar(char c)
          Checks if a character is an ignored character (such as a '-' (dash)).
protected abstract  java.lang.String normalizeMessage(java.lang.String msg)
          Turns the given message into a normalize representation.
 boolean validateChecksum(java.lang.String msg)
          Verifies the checksum for a message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractFourStateLogicImpl

public AbstractFourStateLogicImpl(ChecksumMode mode)
Main constructor

Parameters:
mode - checksum mode
Method Detail

getChecksumMode

public ChecksumMode getChecksumMode()
Returns the currently active checksum mode.

Returns:
the checksum mode

calcChecksum

public abstract char calcChecksum(java.lang.String msg)
Calculates the checksum for a message to be encoded as an one of the foru-state barcode symbologies.

Parameters:
msg - message to calculate the check digit for
Returns:
char the check digit

validateChecksum

public boolean validateChecksum(java.lang.String msg)
Verifies the checksum for a message.

Parameters:
msg - message (check digit included)
Returns:
boolean True, if the checksum is correct

isIgnoredChar

public static boolean isIgnoredChar(char c)
Checks if a character is an ignored character (such as a '-' (dash)).

Parameters:
c - character to check
Returns:
True if the character is ignored

normalizeMessage

protected abstract java.lang.String normalizeMessage(java.lang.String msg)
Turns the given message into a normalize representation. Some subclasses may update/add parentheses around the message and/or handle the checksum as necessary.

Parameters:
msg - the message
Returns:
the normalized message to be encoded

encodeHighLevel

protected abstract java.lang.String[] encodeHighLevel(java.lang.String msg)
Does the high-level encoding of the message into codewords.

Parameters:
msg - the message
Returns:
an array of Strings with codewords

encodeCodeword

protected void encodeCodeword(ClassicBarcodeLogicHandler logic,
                              char c,
                              java.lang.String codeword)
Encodes a single character.

Parameters:
logic - the logic handler to receive generated events
c - the character to encode
codeword - the codeword belonging to the character

generateBarcodeLogic

public void generateBarcodeLogic(ClassicBarcodeLogicHandler logic,
                                 java.lang.String msg)
Generates the barcode logic

Parameters:
logic - the logic handler to receive generated events
msg - the message to encode

barcode4j 2.1.0

Copyright © 2000-2010 Jeremias Maerki. All rights reserved.