org.jscience.arts.printed.isbn
Class ISBNIdentification

java.lang.Object
  extended by org.jscience.measure.Identification
      extended by org.jscience.arts.printed.isbn.ISBNIdentification
All Implemented Interfaces:
java.io.Serializable

public class ISBNIdentification
extends Identification

ISBN wraps a String interpreted as an ISBN. It checks the checksum, too. supports both 10 digit and 13 digit ISBN

See Also:
Serialized Form

Constructor Summary
ISBNIdentification(java.lang.String isbn)
          the constructor requires a valid isbn string; dashes and spaces are ignored.
ISBNIdentification(java.lang.String isbn, boolean fix)
          the constructor requires a valid isbn string; dashes and spaces are ignored.
 
Method Summary
static java.lang.String checkDigit(java.lang.String isbn)
          returns a isbn checkdigit for the first 9 digits in a string
static java.lang.String checkDigit13(java.lang.String isbn)
          returns a isbn checkdigit for the first 12 digits in a string
 boolean equals(ISBNIdentification isbn)
          test for equality
 boolean equals(java.lang.Object isbnString)
          test Strings for equality
 boolean equals(java.lang.String isbnString)
          test Strings for equality
 java.lang.String getDescription()
          DOCUMENT ME!
static void main(java.lang.String[] args)
          DOCUMENT ME!
 java.lang.String toString()
          return 10-digit ISBN unless 979
 java.lang.String toString(boolean isbn13)
          return 13-digit ISBN unless 979 or isbn13 is false
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ISBNIdentification

public ISBNIdentification(java.lang.String isbn)
                   throws InvalidISBNException
the constructor requires a valid isbn string; dashes and spaces are ignored.

Parameters:
isbn - DOCUMENT ME!
Throws:
InvalidISBNException - DOCUMENT ME!

ISBNIdentification

public ISBNIdentification(java.lang.String isbn,
                          boolean fix)
                   throws InvalidISBNException
the constructor requires a valid isbn string; dashes and spaces are ignored.

Parameters:
isbn - DOCUMENT ME!
fix - if true, constructor will try to fix bad check digits, otherwise will throw exception for bad isbn
Throws:
InvalidISBNException - DOCUMENT ME!
Method Detail

toString

public java.lang.String toString()
return 10-digit ISBN unless 979

Specified by:
toString in class Identification
Returns:
DOCUMENT ME!

toString

public java.lang.String toString(boolean isbn13)
return 13-digit ISBN unless 979 or isbn13 is false

Parameters:
isbn13 - DOCUMENT ME!
Returns:
DOCUMENT ME!

checkDigit

public static java.lang.String checkDigit(java.lang.String isbn)
returns a isbn checkdigit for the first 9 digits in a string

Parameters:
isbn - DOCUMENT ME!
Returns:
DOCUMENT ME!

checkDigit13

public static java.lang.String checkDigit13(java.lang.String isbn)
returns a isbn checkdigit for the first 12 digits in a string

Parameters:
isbn - DOCUMENT ME!
Returns:
DOCUMENT ME!

getDescription

public java.lang.String getDescription()
DOCUMENT ME!

Specified by:
getDescription in class Identification
Returns:
DOCUMENT ME!

equals

public boolean equals(ISBNIdentification isbn)
test for equality

Parameters:
isbn - DOCUMENT ME!
Returns:
DOCUMENT ME!

equals

public boolean equals(java.lang.String isbnString)
test Strings for equality

Parameters:
isbnString - DOCUMENT ME!
Returns:
DOCUMENT ME!

equals

public boolean equals(java.lang.Object isbnString)
test Strings for equality

Specified by:
equals in class Identification
Parameters:
isbnString - DOCUMENT ME!
Returns:
DOCUMENT ME!

main

public static void main(java.lang.String[] args)
DOCUMENT ME!

Parameters:
args - DOCUMENT ME!