Class AbstractFourStateLogicImpl
java.lang.Object
org.krysalis.barcode4j.impl.fourstate.AbstractFourStateLogicImpl
- Direct Known Subclasses:
AbstractRMCBCKIXLogicImpl,USPSIntelligentMailLogicImpl
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract charcalcChecksum(String msg) Calculates the checksum for a message to be encoded as an one of the foru-state barcode symbologies.protected voidencodeCodeword(ClassicBarcodeLogicHandler logic, char c, String codeword) Encodes a single character.protected abstract String[]encodeHighLevel(String msg) Does the high-level encoding of the message into codewords.voidgenerateBarcodeLogic(ClassicBarcodeLogicHandler logic, String msg) Generates the barcode logicReturns the currently active checksum mode.static booleanisIgnoredChar(char c) Checks if a character is an ignored character (such as a '-' (dash)).protected abstract StringnormalizeMessage(String msg) Turns the given message into a normalize representation.booleanvalidateChecksum(String msg) Verifies the checksum for a message.
-
Constructor Details
-
AbstractFourStateLogicImpl
Main constructor- Parameters:
mode- checksum mode
-
-
Method Details
-
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
-
getChecksumMode
Returns the currently active checksum mode.- Returns:
- the checksum mode
-
calcChecksum
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
Verifies the checksum for a message.- Parameters:
msg- message (check digit included)- Returns:
- boolean True, if the checksum is correct
-
normalizeMessage
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
Does the high-level encoding of the message into codewords.- Parameters:
msg- the message- Returns:
- an array of Strings with codewords
-
encodeCodeword
Encodes a single character.- Parameters:
logic- the logic handler to receive generated eventsc- the character to encodecodeword- the codeword belonging to the character
-
generateBarcodeLogic
Generates the barcode logic- Parameters:
logic- the logic handler to receive generated eventsmsg- the message to encode
-