Package javax.time.calendar.zone
Class TZDBZoneRulesCompiler
java.lang.Object
javax.time.calendar.zone.TZDBZoneRulesCompiler
A builder that can read the TZDB TimeZone files and build ZoneRules instances.
TZDBZoneRulesCompiler is thread-safe.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) class
Class representing a month-day-time in the TZDB file.(package private) final class
Class representing a rule line in the TZDB file.(package private) final class
Class representing a linked set of zone lines in the TZDB file. -
Field Summary
FieldsModifier and TypeFieldDescriptionThe built zones.A map to deduplicate object instances.The TZDB links.private final Map
<String, List<TZDBZoneRulesCompiler.TZDBRule>> The TZDB rules.The source files.private static final DateTimeFormatter
Time parser.private final boolean
The version to produce.private final String
The version to produce.private final Map
<String, List<TZDBZoneRulesCompiler.TZDBZone>> The TZDB zones. -
Constructor Summary
ConstructorsConstructorDescriptionTZDBZoneRulesCompiler
(String version, List<File> sourceFiles, boolean verbose) Constructor used if you want to invoke the compiler manually. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
Build the rules, zones and links into real zones.compile()
Compile the rules file.(package private) <T> T
deduplicate
(T object) Deduplicates an object instance.static void
Reads a set of TZDB files and builds a single combined data file.private boolean
private static void
Outputs the file.private static void
outputFile
(File dstFile, Map<String, SortedMap<String, ZoneRules>> allBuiltZones, Set<String> allRegionIds, Set<ZoneRules> allRules) Outputs the file.private static void
Output usage text for the command line.private DayOfWeek
parseDayOfWeek
(String str) private void
Parses a source file.private void
Parses the source files.private MonthOfYear
parseMonth
(String str) private void
Parses a Rule line.private ZoneOffset
parseOffset
(String str) private String
parseOptional
(String str) private Period
parsePeriod
(String str) private void
Parses a Rule line.private int
private ZoneRulesBuilder.TimeDefinition
parseTimeDefinition
(char c) private int
private boolean
parseZoneLine
(StringTokenizer st, List<TZDBZoneRulesCompiler.TZDBZone> zoneList) Parses a Zone line.private void
printVerbose
(String message) Prints a verbose message.private static void
Process to create the jar files.(package private) void
setDeduplicateMap
(Map<Object, Object> deduplicateMap) Sets the deduplication map.
-
Field Details
-
TIME_PARSER
Time parser. -
rules
The TZDB rules. -
zones
The TZDB zones. -
links
The TZDB links. -
builtZones
The built zones. -
deduplicateMap
A map to deduplicate object instances. -
version
The version to produce. -
sourceFiles
The source files. -
verbose
private final boolean verboseThe version to produce.
-
-
Constructor Details
-
TZDBZoneRulesCompiler
Constructor used if you want to invoke the compiler manually.- Parameters:
version
- the version, such as 2009a, not nullsourceFiles
- the list of source files, not empty, not nullverbose
- whether to output verbose messages
-
-
Method Details
-
main
Reads a set of TZDB files and builds a single combined data file.- Parameters:
args
- the arguments
-
outputHelp
private static void outputHelp()Output usage text for the command line. -
process
private static void process(List<File> srcDirs, List<String> srcFileNames, File dstDir, boolean verbose) Process to create the jar files. -
outputFile
private static void outputFile(File dstFile, String version, SortedMap<String, ZoneRules> builtZones) Outputs the file. -
outputFile
private static void outputFile(File dstFile, Map<String, SortedMap<String, ZoneRules>> allBuiltZones, Set<String> allRegionIds, Set<ZoneRules> allRules) Outputs the file. -
compile
Compile the rules file.- Returns:
- the map of region ID to rules, not null
- Throws:
Exception
- if an error occurs
-
setDeduplicateMap
Sets the deduplication map.- Parameters:
deduplicateMap
- the map to deduplicate items
-
parseFiles
Parses the source files.- Throws:
Exception
- if an error occurs
-
parseFile
Parses a source file.- Parameters:
file
- the file being read, not null- Throws:
Exception
- if an error occurs
-
parseRuleLine
Parses a Rule line.- Parameters:
st
- the tokenizer, not null
-
parseZoneLine
Parses a Zone line.- Parameters:
st
- the tokenizer, not null- Returns:
- true if the zone is complete
-
parseMonthDayTime
Parses a Rule line.- Parameters:
st
- the tokenizer, not nullmdt
- the object to parse into, not null
-
parseYear
-
parseMonth
-
parseDayOfWeek
-
matches
-
parseOptional
-
parseSecs
-
parseOffset
-
parsePeriod
-
parseTimeDefinition
-
buildZoneRules
Build the rules, zones and links into real zones.- Throws:
Exception
- if an error occurs
-
deduplicate
<T> T deduplicate(T object) Deduplicates an object instance.- Type Parameters:
T
- the generic type- Parameters:
object
- the object to deduplicate- Returns:
- the deduplicated object
-
printVerbose
Prints a verbose message.- Parameters:
message
- the message, not null
-