Class UPCELogicImpl
java.lang.Object
org.krysalis.barcode4j.impl.upcean.UPCEANLogicImpl
org.krysalis.barcode4j.impl.upcean.UPCELogicImpl
This class is an implementation of the UPC-E barcode.
- Version:
- $Id: UPCELogicImpl.java,v 1.2 2004-10-24 11:45:53 jmaerki Exp $
- Author:
- Jeremias Maerki
-
Field Summary
Fields inherited from class org.krysalis.barcode4j.impl.upcean.UPCEANLogicImpl
EVEN_PARITY, LEFT_HAND_A, LEFT_HAND_B, ODD_PARITY, RIGHT_HAND -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcompactMessage(String msg) Compacts an UPC-A message to an UPC-E message if possible.protected voidGenerates a UPC-E right guard.static StringexpandMessage(String msg) Expands an UPC-E message to an UPC-A message.voidgenerateBarcodeLogic(ClassicBarcodeLogicHandler logic, String msg) Generates the barcode logic.static voidvalidateMessage(String msg) Validates an UPC-E message.Methods inherited from class org.krysalis.barcode4j.impl.upcean.UPCEANLogicImpl
calcChecksum, drawCenterGuard, drawSideGuard, drawSupplemental, encodeChar, getChecksumMode, getSupplementalLength, removeSupplemental, retrieveSupplemental
-
Constructor Details
-
UPCELogicImpl
Main constructor- Parameters:
mode- the checksum mode
-
-
Method Details
-
compactMessage
Compacts an UPC-A message to an UPC-E message if possible.- Parameters:
msg- an UPC-A message- Returns:
- String the derived UPC-E message (with checksum), null if the message is a valid UPC-A message but no UPC-E representation is possible
-
expandMessage
Expands an UPC-E message to an UPC-A message.- Parameters:
msg- an UPC-E message (7 or 8 characters)- Returns:
- String the expanded UPC-A message (with checksum, 12 characters)
-
validateMessage
Validates an UPC-E message. The message can also be UPC-A in which case the message is compacted to a UPC-E message if possible. If it's not possible an IllegalArgumentException is thrown- Parameters:
msg- the message to validate
-
drawUPCERightGuard
Generates a UPC-E right guard.- Parameters:
logic- the logic handler to receive generated events
-
generateBarcodeLogic
Description copied from class:UPCEANLogicImplGenerates the barcode logic.- Specified by:
generateBarcodeLogicin classUPCEANLogicImpl- Parameters:
logic- the logic handler to receive generated eventsmsg- the message to encode- See Also:
-