uk.ac.cisban.rod.parsing.util
Class BarcodePatternMatching

java.lang.Object
  extended by uk.ac.cisban.rod.parsing.util.BarcodePatternMatching

public class BarcodePatternMatching
extends java.lang.Object

Checks to see if the barcodes match the pattern of three capital letters and eight numbers and prompts the user for any changes.

Author:
Morgan Taschuk

Constructor Summary
BarcodePatternMatching()
           
 
Method Summary
static java.util.Map<java.lang.String,java.lang.String> checkBarcodes(java.util.ArrayList<java.lang.String> barcodes)
          Check to see if the barcodes match the pattern of three capital letters and eight numbers and prompts the user for any changes.
static void main(java.lang.String[] args)
           
static java.util.Collection<java.lang.String> substituteBarcodes(java.util.Collection<java.lang.String> barcodes, java.util.Map<java.lang.String,java.lang.String> barcodeSubs)
          Creates a new list in the same order as the given one, but substituting the given barcodes for the original ones.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BarcodePatternMatching

public BarcodePatternMatching()
Method Detail

substituteBarcodes

public static java.util.Collection<java.lang.String> substituteBarcodes(java.util.Collection<java.lang.String> barcodes,
                                                                        java.util.Map<java.lang.String,java.lang.String> barcodeSubs)
Creates a new list in the same order as the given one, but substituting the given barcodes for the original ones.

Parameters:
barcodes - the list of barcodes
barcodeSubs - the map of barcodes to switch out
Returns:
a list ordered exactly the same but with some different barcodes
See Also:
BarcodePatternMatching.checkBarcodes(ArrayList barcodes)

checkBarcodes

public static java.util.Map<java.lang.String,java.lang.String> checkBarcodes(java.util.ArrayList<java.lang.String> barcodes)
                                                                      throws IncorrectInputException
Check to see if the barcodes match the pattern of three capital letters and eight numbers and prompts the user for any changes. The regular expression for this pattern is [A-Z]{3}\d{8} . The ordering is kept the same through the use of an ArrayList.

Parameters:
barcodes - a list of barcodes to be checked
Returns:
a Map of the old barcodes to the new barcodes
Throws:
IncorrectInputException

main

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


Copyright © 2010. All Rights Reserved.