Class CodebookValidator
java.lang.Object
TwoColumnValidator
CodebookValidator
- All Implemented Interfaces:
- Validator
public class CodebookValidator
- extends TwoColumnValidator
Validator for parsing symbol-code pairs.
Returns LinkedHashMap<String,String> representing codebook.
Entries should be given one per line using format as:
a 01
b 00
e 1
Blank lines are ignored. Lines with only a frequency are presumed
to have string " " as the symbol.
Dialog ensures that symbols are unique and codes are prefix-free.
Note that symbols can be any distinct strings (not just characters).
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CodebookValidator
public CodebookValidator()
parse
public LinkedHashMap<String,String> parse(String original)
throws ValidatorException
- Parses symbol-codeword data.
Assumes format described in class overview.
- Specified by:
parse
in interface Validator
- Overrides:
parse
in class TwoColumnValidator
- Parameters:
original
- String
- Returns:
- LinkedHashMap<String,String> describing codewords for each symbol
- Throws:
ValidatorException
- if codewords not 0/1 strings, if codebook
is not prefix-free, or if any error conditions detected through
TwoColumnValidator.parse(String)