barcode4j 2.1.0

org.krysalis.barcode4j.impl.postnet
Class POSTNETLogicImpl

java.lang.Object
  extended by org.krysalis.barcode4j.impl.postnet.POSTNETLogicImpl

public class POSTNETLogicImpl
extends java.lang.Object

Implements the United States Postal Service Postnet barcode.

Version:
$Id: POSTNETLogicImpl.java,v 1.3 2006/11/07 16:42:17 jmaerki Exp $
Author:
Chris Dolphy

Constructor Summary
POSTNETLogicImpl(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 POSTNET barcode.
protected  void encodeChar(ClassicBarcodeLogicHandler logic, char c)
          Encodes a single character.
 void generateBarcodeLogic(ClassicBarcodeLogicHandler logic, java.lang.String msg)
          Generates the barcode logic
 ChecksumMode getChecksumMode()
          Returns the currently active checksum mode.
static boolean isIgnoredChar(char c)
          Checks if a character is an ignored character (such as a '-' (dash)).
static java.lang.String removeIgnoredCharacters(java.lang.String msg)
          Removes ignored character from a valid POSTNET message.
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

POSTNETLogicImpl

public POSTNETLogicImpl(ChecksumMode mode,
                        boolean displayChecksum)
Main constructor

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

getChecksumMode

public ChecksumMode getChecksumMode()
Returns the currently active checksum mode.

Returns:
the checksum mode

calcChecksum

public static char calcChecksum(java.lang.String msg)
Calculates the checksum for a message to be encoded as an POSTNET barcode.

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

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

removeIgnoredCharacters

public static java.lang.String removeIgnoredCharacters(java.lang.String msg)
Removes ignored character from a valid POSTNET message.

Parameters:
msg - valid POSTNET message
Returns:
the message but without ignored characters

encodeChar

protected void encodeChar(ClassicBarcodeLogicHandler logic,
                          char c)
Encodes a single character.

Parameters:
logic - the logic handler to receive generated events
c - the character to encode

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.