net.sourceforge.jbarcodebean.model
Class Codabar

java.lang.Object
  extended by net.sourceforge.jbarcodebean.model.AbstractBarcodeStrategy
      extended by net.sourceforge.jbarcodebean.model.Codabar
All Implemented Interfaces:
java.io.Serializable, BarcodeStrategy
Direct Known Subclasses:
Codabar_2to1

public class Codabar
extends AbstractBarcodeStrategy
implements java.io.Serializable

This class, which implements the BarcodeStrategy interface, knows how to encode the 3:1 (wide) variant of the Codabar barcode type.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class net.sourceforge.jbarcodebean.model.AbstractBarcodeStrategy
AbstractBarcodeStrategy.CharacterCode
 
Field Summary
 
Fields inherited from interface net.sourceforge.jbarcodebean.model.BarcodeStrategy
MANDATORY_CHECKSUM, NO_CHECKSUM, OPTIONAL_CHECKSUM
 
Constructor Summary
Codabar()
           
 
Method Summary
protected  java.lang.String augmentWithChecksum(java.lang.String text)
          Codabar does not have a checksum, so this function should never be called.
protected  java.lang.String getBarcodeLabelText(java.lang.String text)
          This implementation of getBarcodeLabelText does nothing except return the text passed to the method.
protected  AbstractBarcodeStrategy.CharacterCode[] getCodes()
          This implementation of getCodes returns an array of CharacterCode objects for the wide Codabar format.
protected  byte getMarginWidth()
          Always returns 11 (eleven).
protected  char getStartSentinel()
          Always returns 'A'.
protected  char getStopSentinel()
          Always returns 'B'.
protected  boolean isInterleaved()
          Always returns false
protected  java.lang.String postprocess(java.lang.String text)
          This implementation of postprocess does nothing except return the text passed to the method.
protected  java.lang.String preprocess(java.lang.String text)
          This implementation of preprocess does nothing except return the text passed to the method.
 int requiresChecksum()
          Always returns BarcodeStrategy.NO_CHECKSUM.
 
Methods inherited from class net.sourceforge.jbarcodebean.model.AbstractBarcodeStrategy
computeSize, encode, getCharacterCode, getCharacterCode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Codabar

public Codabar()
Method Detail

requiresChecksum

public int requiresChecksum()
Always returns BarcodeStrategy.NO_CHECKSUM.

Specified by:
requiresChecksum in interface BarcodeStrategy

getCodes

protected AbstractBarcodeStrategy.CharacterCode[] getCodes()
This implementation of getCodes returns an array of CharacterCode objects for the wide Codabar format.

Specified by:
getCodes in class AbstractBarcodeStrategy
Returns:
An array of CharacterCode objects, one for each possible character that can be encoded using this strategy.

augmentWithChecksum

protected java.lang.String augmentWithChecksum(java.lang.String text)
                                        throws BarcodeException
Codabar does not have a checksum, so this function should never be called. This implementation simply throws an exception.

Specified by:
augmentWithChecksum in class AbstractBarcodeStrategy
Parameters:
text - The text to encode (after preprocessing - see AbstractBarcodeStrategy.preprocess(java.lang.String)).
Returns:
A String containing the text passed into the method, augmented with the checksum. For barcode types that don't support a checksum, this would simply be the text passed to the method.
Throws:
BarcodeException

postprocess

protected java.lang.String postprocess(java.lang.String text)
This implementation of postprocess does nothing except return the text passed to the method.

Specified by:
postprocess in class AbstractBarcodeStrategy
Parameters:
text - String to process (returned by AbstractBarcodeStrategy.augmentWithChecksum(java.lang.String)).
Returns:
String after postprocessing. If no postprocessing is required, the String passed to the method is returned.

preprocess

protected java.lang.String preprocess(java.lang.String text)
This implementation of preprocess does nothing except return the text passed to the method.

Specified by:
preprocess in class AbstractBarcodeStrategy
Parameters:
text - The raw text to encode.
Returns:
The string after preprocessing. If no preprocessing is required, the String passed to the method is returned.

isInterleaved

protected boolean isInterleaved()
Always returns false

Specified by:
isInterleaved in class AbstractBarcodeStrategy
Returns:
true if barcode type is interleaved, false if it is not.

getStartSentinel

protected char getStartSentinel()
Always returns 'A'.

Specified by:
getStartSentinel in class AbstractBarcodeStrategy
Returns:
The character, which when encoded into bars and spaces, appears on the left edge of every barcode (immediately after the left margin).

getStopSentinel

protected char getStopSentinel()
Always returns 'B'.

Specified by:
getStopSentinel in class AbstractBarcodeStrategy
Returns:
The character, which when encoded into bars and spaces, appears on the right edge of every barcode (just before the right margin).

getMarginWidth

protected byte getMarginWidth()
Always returns 11 (eleven).

Specified by:
getMarginWidth in class AbstractBarcodeStrategy
Returns:
The space that must appear on the left and right sides of the barcode expressed as a multiple of the narrowest bar width.

getBarcodeLabelText

protected java.lang.String getBarcodeLabelText(java.lang.String text)
This implementation of getBarcodeLabelText does nothing except return the text passed to the method.

Specified by:
getBarcodeLabelText in class AbstractBarcodeStrategy
Parameters:
text - The raw text to encode.
Returns:
A String containing the text that will appear beneath the barcode.


Copyright © 2004-2009 The JBarcodeBean project. All Rights Reserved.