*/
package tool;
-import gnu.regexp.RE;
-
import java.security.MessageDigest;
import java.util.TimeZone;
import mir.util.StringRoutines;
+import org.apache.oro.text.regex.Perl5Compiler;
+import org.apache.oro.text.regex.Pattern;
+import org.apache.oro.text.regex.Perl5Matcher;
+import org.apache.oro.text.regex.PatternMatcher;
/**
* <p>Title: </p>
public static void timezone(String aSpecification) {
try {
- RE specification = new RE(aSpecification);
+ PatternMatcher matcher = new Perl5Matcher();
+ Pattern specification = new Perl5Compiler().compile(aSpecification);
String[] timeZoneIds = TimeZone.getAvailableIDs();
System.out.println("ID\tOffset\tDST?\tName");
for (int i=0; i<timeZoneIds.length; i++) {
- if (specification.isMatch(timeZoneIds[i])) {
+ if (matcher.contains(timeZoneIds[i], specification)) {
TimeZone timeZone = TimeZone.getTimeZone(timeZoneIds[i]);
long offset = timeZone.getRawOffset()/(1000*60);
String sign = "";
}
public static void main(String[] anArguments) {
- String command = "help";
+ String command;
if (anArguments.length >= 1) {
command = anArguments[0];
- if (command.equals("timezone")) {
+ if ("timezone".equals(command)) {
if (anArguments.length<=2) {
if (anArguments.length==2)
timezone(anArguments[1]);
return;
}
- else if (command.equals("digest")) {
+ else if ("digest".equals(command)) {
if (anArguments.length == 3) {
digest(anArguments[1], anArguments[2]);