[Javacavemaps-developers] the flat file parsers
Status: Pre-Alpha
Brought to you by:
caverdude
From: Larry G. <jav...@ya...> - 2009-02-07 17:45:09
|
I have come up with a fairly good design.. Not sure it you can apply it any pattern at this point but here goes. parsers package contains some interfaces associated with 3 types of parsing and a Parser interface. parsers.flatfile contains one abstract parser and 4 concrete parsers. Each parser will have a private no arges constructor, will have 3 constructors that take File, InputStream or String as parameters. NOTE that java.util.Scanner works with these 3 objects. All 4 types will produce a FlatFileModel which will be given to survey parsers. A flat file model will either get the client class any given line or field in the flat file, or provide a line or field iterator. parser.survey will have a SurveyLineParser and a SurveyStationParser. Each one will be constructed with a Parser as its parameter. So if we are getting survey line data fixedwidth data file from a resource it would look like this.. surveyLineParser = new SurveyLineParser(new FixedWidthParser(resourceInputStream)); anArrayList= surveyLineParser.getList(); // gets a list of SurveyLineModels. of course this needs to be rewritten so that it uses generics. Larry Gray la...@ar... |