Class Code128LogicImpl
java.lang.Object
org.krysalis.barcode4j.impl.code128.Code128LogicImpl
This class is an implementation of the Code 128 barcode.
- Version:
- $Id: Code128LogicImpl.java,v 1.5 2009-02-20 13:07:21 jmaerki Exp $
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancanBeInCodeSetC(char ch, boolean second) Determines whether a character is a digit or a function 1 command.protected voidencodeChar(ClassicBarcodeLogicHandler logic, int index) Encodes a character.protected voidEncodes the special stop character.voidgenerateBarcodeLogic(ClassicBarcodeLogicHandler logic, String msg) Generates the barcode logicprotected Code128EncoderReturns the encoder to be used.static booleanisInCodeSetA(char ch) Determines whether a character is defined in codeset A.static booleanisInCodeSetB(char ch) Determines whether a character is defined in codeset B.static booleanisValidChar(char ch) Determines whether a character can be encoded in Code 128.static StringsymbolCharToString(int index) Converts a character set index to a String representation.static StringtoString(int[] encodedMsg) Converts an encoded Code 128 message into a String for debugging purposes.
-
Field Details
-
FNC_1
public static final char FNC_1The function 1 command. ASCII: 0xF1- See Also:
-
FNC_2
public static final char FNC_2The function 2 command. ASCII: 0xF2- See Also:
-
FNC_3
public static final char FNC_3The function 3 command. ASCII: 0xF3- See Also:
-
FNC_4
public static final char FNC_4The function 4 command. ASCII: 0xF4- See Also:
-
-
Constructor Details
-
Code128LogicImpl
public Code128LogicImpl()Default constructor. -
Code128LogicImpl
public Code128LogicImpl(int codeset) Main constructor.- Parameters:
codeset- the enabled codeset
-
-
Method Details
-
isValidChar
public static boolean isValidChar(char ch) Determines whether a character can be encoded in Code 128.- Parameters:
ch- the character to check- Returns:
- true if it is a valid character
-
isInCodeSetA
public static boolean isInCodeSetA(char ch) Determines whether a character is defined in codeset A.- Parameters:
ch- the character to check- Returns:
- true if it is found in codeset A
-
isInCodeSetB
public static boolean isInCodeSetB(char ch) Determines whether a character is defined in codeset B.- Parameters:
ch- the character to check- Returns:
- true if it is found in codeset B
-
canBeInCodeSetC
public static boolean canBeInCodeSetC(char ch, boolean second) Determines whether a character is a digit or a function 1 command.- Parameters:
ch- the character to checksecond- true if checking the character for the second position in a duo.- Returns:
- true if the above condition is met
-
symbolCharToString
Converts a character set index to a String representation. This is primarily used for debugging purposes.- Parameters:
index- the character set index- Returns:
- the String representation
-
toString
Converts an encoded Code 128 message into a String for debugging purposes.- Parameters:
encodedMsg- the encoded message- Returns:
- the String representation
-
encodeChar
Encodes a character.- Parameters:
logic- LogicHandler to send the barcode events toindex- index withing the character set of the character to encode
-
encodeStop
Encodes the special stop character.- Parameters:
logic- LogicHandler to send the barcode events to
-
getEncoder
Returns the encoder to be used. The encoder is responsible for turning a String message into an array of character set indexes.Override this method to supply your own implementation.
- Returns:
- the requested encoder
-
generateBarcodeLogic
Generates the barcode logic- Parameters:
logic- the logic handler to receive the generated eventsmsg- the message to encode
-