barcode4j 2.0

org.krysalis.barcode4j.impl.int2of5
Class Interleaved2Of5LogicImpl

java.lang.Object
  extended byorg.krysalis.barcode4j.impl.int2of5.Interleaved2Of5LogicImpl

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.2 2004/10/24 11:45:37 jmaerki Exp $
Author:
Jeremias Maerki

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.
 void generateBarcodeLogic(ClassicBarcodeLogicHandler logic, java.lang.String msg)
          Generates the barcode logic.
 ChecksumMode getChecksumMode()
          Returns the current 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

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.0

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