[CVS spice] Update EnumSet to use jdk1.4s regex engine rather than oror
pdonald-yCVjj/[email protected] 11 Jul 2004 23:34:39 -0000
| Newsgroups | gmane.comp.java.spice.cvs |
|---|---|
| Message-ID | <[email protected]> |
<html>
<head>
<style><!--
body {background-color:#ffffff;}
.file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
.pathname {font-family:monospace; float:right;}
.fileheader {margin-bottom:.5em;}
.diff {margin:0;}
.tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
.tasklist ul {margin-top:0;margin-bottom:0;}
tr.alt {background-color:#eeeeee}
#added {background-color:#ddffdd;}
#addedchars {background-color:#99ff99;font-weight:bolder;}
tr.alt #added {background-color:#ccf7cc;}
#removed {background-color:#ffdddd;}
#removedchars {background-color:#ff9999;font-weight:bolder;}
tr.alt #removed {background-color:#f7cccc;}
#info {color:#888888;}
#context {background-color:#eeeeee;}
td {padding-left:.3em;padding-right:.3em;}
tr.head {border-bottom-width:1px;border-bottom-style:solid;}
tr.head td {padding:0;padding-top:.2em;}
.task {background-color:#ffff00;}
.comment {padding:4px;border:1px dashed #000000;background-color:#ffffdd}
.error {color:red;}
hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="4">Commit in <b><tt>spice/components/salt/src/java/org/codehaus/spice/salt/lang</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt><a href="#file1">EnumSet.java</a></tt></td><td align="right" id="added">+9</td><td align="right" id="removed">-23</td><td nowrap="nowrap" align="center">1.1 -> 1.2</td></tr>
</table>
<pre class="comment">
Update EnumSet to use jdk1.4s regex engine rather than oror
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname">spice/components/salt/src/java/org/codehaus/spice/salt/lang<br /></span>
<div class="fileheader"><big><b>EnumSet.java</b></big> <small id="info">1.1 -> 1.2</small></div>
<pre class="diff"><small id="info">diff -u -r1.1 -r1.2
--- EnumSet.java 2 Dec 2003 02:15:04 -0000 1.1
+++ EnumSet.java 11 Jul 2004 23:34:39 -0000 1.2
@@ -13,11 +13,8 @@
</small></pre><pre class="diff" id="context"> import java.util.HashMap;
import java.util.Map;
import java.util.Set;
</pre><pre class="diff" id="removed">-import org.apache.oro.text.regex.MalformedPatternException;
-import org.apache.oro.text.regex.MatchResult;
-import org.apache.oro.text.regex.Pattern;
-import org.apache.oro.text.regex.Perl5Compiler;
-import org.apache.oro.text.regex.Perl5Matcher;
</pre><pre class="diff" id="added">+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
</pre><pre class="diff" id="context">
/**
* A Utility class for managing a set of name-integer constants.
</pre><pre class="diff"><small id="info">@@ -158,19 +155,8 @@
</small></pre><pre class="diff" id="context"> final String patternString,
final boolean deep )
{
</pre><pre class="diff" id="removed">- final Perl5Matcher matcher = new Perl5Matcher();
- final Perl5Compiler compiler = new Perl5Compiler();
- final Pattern pattern;
- try
- {
- pattern = compiler.compile( patternString );
- }
- catch( final MalformedPatternException mpe )
- {
- final String message =
- "Malformed pattern " + patternString + ". Reason: " + mpe;
- throw new IllegalArgumentException( message );
- }
</pre><pre class="diff" id="added">+ final Pattern pattern = Pattern.compile( patternString );
+ final Matcher matcher = pattern.matcher( "" );
</pre><pre class="diff" id="context">
final EnumSet set = new EnumSet();
final Field[] fields = getFields( clazz, deep );
</pre><pre class="diff"><small id="info">@@ -197,16 +183,16 @@
</small></pre><pre class="diff" id="context"> throw new IllegalStateException( message );
}
</pre><pre class="diff" id="removed">- if( matcher.contains( name, pattern ) )
</pre><pre class="diff" id="added">+ matcher.reset( name );
+ if( matcher.matches() )
</pre><pre class="diff" id="context"> {
</pre><pre class="diff" id="removed">- final MatchResult match = matcher.getMatch();
- final int groups = match.groups();
- if( 2 != groups )
</pre><pre class="diff" id="added">+ final int groups = matcher.groupCount();
+ if( 1 != groups )
</pre><pre class="diff" id="context"> {
final String message = "Pattern must have one group";
throw new IllegalArgumentException( message );
}
</pre><pre class="diff" id="removed">- final String key = match.group( 1 );
</pre><pre class="diff" id="added">+ final String key = match<span id="addedchars">er</span>.group( 1 );
</pre><pre class="diff" id="context"> set.add( key, value );
}
}
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -> email">CVSspam</a> 0.2.8</small></center>
</body></html>