A very brief tour round the code. Entry points, classes dependencies etc. Firstly it won't run without XOM from Elliotte being in your classpath. See XOM home page. I've used 1.1 to date. Its use is to parse and access the rules file. That's the only dependency. I've built it using Sun java version "1.5.0_08". AFAIK they are the only dependencies.
Classes. org.dpawson.format is used to format the braille. It is incomplete and only partially tested. org.dpawson.impl is the main implementation package. The BrailleEngineFactory is responsible for despatching to an appropriate language braille table using the Factory Pattern. The BrailleTable package holds the language independent methods and abstract methods that need to be implemented for a new language. This is an abstract class. ENBrailleTable, SEBrailleTable and XXBrailleTable are three implementations of BrailleTable. ENBrailleTable is as complete as I have been able to make it, to date. SE is a shell, as is XX (there to help others make a start on their own transcription engine). org.dpawson.test contains TestBrf (formatter tests) and TestTranslate which tests the translation engine. Take this as the main entry point, since it loads the appropriate braille table etc. org.dpawson.util holds classes I believe to be utilitarian. AnalysisResult is a replacement for a C# struct, holding the type and length of match when a piece of input text is analysed. Modes are the various types that we found necessary for EN braille. Currently stands at ACRONYM, DATE, POSTCODE and ROMANNUMERAL. The Test class is used solely for testing and obtaining a documented output. The Version class is the version of the translator. All source and javadocs are in the jar. I've used NetBeans to build it all, so the jar is a little bit of a mystery. See download
I'll add more detail as needed. Let me know what you think. It's all GPL so I'd be grateful if you'd let me know of any additions.
In order to help understand the code, I'll talk you through the sequence from loading the table to returning the transcribed braille. Starting with TestTranslate.main().
Firstly go find a braille table. BrailleEngineFactory.createBrailleTable() does this. ENBrailleTable then picks up and loads the English braille table from the given file (ENRules.xml in this case). XOM is used to parse the input file and prefill both optimisationTable and the array of rules (in the BrailleTable class). This returns a BrailleTable object to the TestTranslate class.
The next major use is the Translate() method in the TextToBraille class. There are two of these, one taking the default grade, one taking a second parameter of the required grade. This method iterates over the input text until fully processed. The sequence is to determine the mode using ENBrailleTable.analyse() to determine how to process the next piece of text. The type is specified by the org.dpawson.util.AnalysisResult class. This returns both the type (one from the list at org.dpawson.util.Modes. Dependent on the returned mode the if then else chain in Translate() processes appropriately. The last clause, used for the DEFAULT mode, is where the hard work is done. The first action is to use getRuleNumber() to obtain the appropriate rule. Next check for capitalization and process accordingly. Finally append the output from the rule to the StringBuilder object, and move on in the input text being processed. Then continue iterating over the input text! Easy really (No, I didn't think so either!). Finally this translated text is returned to the calling method.