barcode4j 2.1.0

org.krysalis.barcode4j.impl.int2of5
Class Interleaved2Of5LogicImpl

java.lang.Object
  extended by org.krysalis.barcode4j.impl.int2of5.Interleaved2Of5LogicImpl
Direct Known Subclasses:
ITF14LogicImpl

public class Interleaved2Of5LogicImpl
extends java.lang.Object

This class is an implementation of the Interleaved 2 of 5 barcode.

Version:
$Id: Interleaved2Of5LogicImpl.java,v 1.3 2009/02/19 10:14:54 jmaerki Exp $

Constructor Summary
Interleaved2Of5LogicImpl(ChecksumMode mode, boolean displayChecksum)
          Main constructor.
 
Method Summary
static char calcChecksum(java.lang.String msg)
          Calculates the checksum for a message to be encoded as an Interleaved 2 of 5 barcode.
static char calcChecksum(java.lang.String msg, int oddMultiplier, int evenMultiplier)
          Calculates the checksum for a message to be encoded as an Interleaved 2 of 5 barcode.
protected  java.lang.String doHandleChecksum(java.lang.StringBuffer sb, ChecksumMode mode)
          Handles the checksum based on the given checksum mode.
 void generateBarcodeLogic(ClassicBarcodeLogicHandler logic, java.lang.String msg)
          Generates the barcode logic.
 ChecksumMode getChecksumMode()
          Returns the current checksum mode
protected  java.lang.String handleChecksum(java.lang.StringBuffer sb)
          Handles the checksum based on the checksum mode.
static 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

Interleaved2Of5LogicImpl

public Interleaved2Of5LogicImpl(ChecksumMode mode,
                                boolean displayChecksum)
Main constructor.

Parameters:
mode - the checksum mode
displayChecksum - Controls whether to display checksum in the human-readable message
Method Detail

getChecksumMode

public ChecksumMode getChecksumMode()
Returns the current checksum mode

Returns:
the checksum mode

calcChecksum

public static char calcChecksum(java.lang.String msg,
                                int oddMultiplier,
                                int evenMultiplier)
Calculates the checksum for a message to be encoded as an Interleaved 2 of 5 barcode. The algorithm is a weighted modulo 10 scheme.

Parameters:
msg - message to calculate the check digit for
oddMultiplier - multiplier to be used for odd positions (usually 3 or 4)
evenMultiplier - multiplier to be used for even positions (usually 1 or 9)
Returns:
char the check digit

calcChecksum

public static char calcChecksum(java.lang.String msg)
Calculates the checksum for a message to be encoded as an Interleaved 2 of 5 barcode. The algorithm is a weighted modulo 10 scheme. This method uses the default specification (ITF-14, EAN-14, SSC-14, DUN14 and USPS).

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

validateChecksum

public static 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

doHandleChecksum

protected java.lang.String doHandleChecksum(java.lang.StringBuffer sb,
                                            ChecksumMode mode)
Handles the checksum based on the given checksum mode. The checksum is either checked, ignored or attached to the given string buffer.

Parameters:
sb - the string buffer containing the message
mode - the checksum mode
Returns:
the updated string after checksum processing (for the human-readable part)

handleChecksum

protected java.lang.String handleChecksum(java.lang.StringBuffer sb)
Handles the checksum based on the checksum mode. The checksum is either checked, ignored or attached to the given string buffer.

Parameters:
sb - the string buffer containing the message
Returns:
the updated string after checksum processing (for the human-readable part)

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.