net.sourceforge.jbarcodebean.model
Class BaseCode39

java.lang.Object
  extended by net.sourceforge.jbarcodebean.model.AbstractBarcodeStrategy
      extended by net.sourceforge.jbarcodebean.model.BaseCode39
All Implemented Interfaces:
BarcodeStrategy
Direct Known Subclasses:
Code39, ExtendedCode39

public abstract class BaseCode39
extends AbstractBarcodeStrategy

Base class for Code39 variants.


Nested Class Summary
 
Nested classes/interfaces inherited from class net.sourceforge.jbarcodebean.model.AbstractBarcodeStrategy
AbstractBarcodeStrategy.CharacterCode
 
Field Summary
protected static AbstractBarcodeStrategy.CharacterCode[] codes
          A static array of CharacterCode objects for the 3:1 (wide) variants of Code 39.
protected static AbstractBarcodeStrategy.CharacterCode[] codes2to1
          A static array of CharacterCode objects for the 2:1 (narrow) variants of Code 39.
 
Fields inherited from interface net.sourceforge.jbarcodebean.model.BarcodeStrategy
MANDATORY_CHECKSUM, NO_CHECKSUM, OPTIONAL_CHECKSUM
 
Constructor Summary
BaseCode39()
           
 
Method Summary
protected  java.lang.String augmentWithChecksum(java.lang.String text)
          Returns a String containing the checksum-encoded version of the text passed to the method.
protected  byte getMarginWidth()
          Always returns 11 (eleven).
protected  char getStartSentinel()
          Always returns '*' (asterisk).
protected  char getStopSentinel()
          Always returns '*' (asterisk).
protected  boolean isInterleaved()
          Always returns false.
protected  java.lang.String postprocess(java.lang.String text)
          Does nothing except return the String passed to the method.
 int requiresChecksum()
          Always returns BarcodeStrategy.OPTIONAL_CHECKSUM.
 
Methods inherited from class net.sourceforge.jbarcodebean.model.AbstractBarcodeStrategy
computeSize, encode, getBarcodeLabelText, getCharacterCode, getCharacterCode, getCodes, preprocess
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

codes

protected static AbstractBarcodeStrategy.CharacterCode[] codes
A static array of CharacterCode objects for the 3:1 (wide) variants of Code 39. The getCodes() method of the wide Code 39 subclasses (Code39 and ExtendedCode39) return this array.


codes2to1

protected static AbstractBarcodeStrategy.CharacterCode[] codes2to1
A static array of CharacterCode objects for the 2:1 (narrow) variants of Code 39. The getCodes() method of the narrow Code 39 subclasses (Code39_2to1 and ExtendedCode39_2to1) return this array.

Constructor Detail

BaseCode39

public BaseCode39()
Method Detail

requiresChecksum

public int requiresChecksum()
Always returns BarcodeStrategy.OPTIONAL_CHECKSUM.


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.

getStartSentinel

protected char getStartSentinel()
Always returns '*' (asterisk).

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 '*' (asterisk).

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

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.

postprocess

protected java.lang.String postprocess(java.lang.String text)
Does nothing except return the String 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.

augmentWithChecksum

protected java.lang.String augmentWithChecksum(java.lang.String text)
                                        throws BarcodeException
Returns a String containing the checksum-encoded version of the text passed to the method. Start and End sentinels must NOT be included in the text passed to this method.

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


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