/**
* This class is used to store a result from Regex
*/
-public class RegRes implements Cloneable
+public class RegRes
{
protected int[] marks = null;
{
int n = i + 1;
sb
- .append(" sub(" + n + ")=" + matchedFrom(n) + ":"
- + charsMatched(n));
+ .append(" sub(" + n + ")=" + matchedFromI(n) + ":"
+ + charsMatchedI(n));
}
return sb.toString();
}
- public RegRes()
- {
- }
-
- public RegRes(RegRes r)
- {
- copyOutOf(r);
- }
+// public RegRes()
+// {
+// }
+//
+// public RegRes(RegRes r)
+// {
+// copyOutOf(r);
+// }
public void copyOutOf(RegRes r)
{
numSubs_ = r.numSubs_;
}
- public Object clone()
- {
- return new RegRes(this);
- }
-
+// public Object clone()
+// {
+// return new RegRes(this);
+// }
+//
public boolean equals(RegRes r)
{
if (charsMatched_ != r.charsMatched_ || matchFrom_ != r.matchFrom_
}
for (int i = 1; i <= numSubs_; i++)
{
- if (matchedFrom(i) != r.matchedFrom(i))
+ if (matchedFromI(i) != r.matchedFromI(i))
{
return false;
}
- else if (charsMatched(i) != r.charsMatched(i))
+ else if (charsMatchedI(i) != r.charsMatchedI(i))
{
return false;
}
* Obtains the position backreference number i begins to match, or -1 if
* backreference i was not matched.
*/
- public int matchedFrom(int i)
+ public int matchedFromI(int i)
{
if (marks == null || i > numSubs_)
{
* Obtains the number of characters matched by backreference i, or -1 if
* backreference i was not matched.
*/
- public int charsMatched(int i)
+ public int charsMatchedI(int i)
{
if (marks == null || i > numSubs_ || !didMatch_)
{
}
// Integer in = (Integer)marks.get("right"+i);
// int i2 = in==null ? -1 : in.intValue();
- int mf = matchedFrom(i);
- return mf < 0 ? -1 : marks[i + numSubs_] - matchedFrom(i);
+ int mf = matchedFromI(i);
+ return mf < 0 ? -1 : marks[i + numSubs_] - matchedFromI(i);
}
/**
* This is either equal to matchedFrom(i)+charsMatched(i) if the match was
* successful, or -1 if it was not.
*/
- public int matchedTo(int i)
+ public int matchedToI(int i)
{
if (marks == null || i > numSubs_ || !didMatch_)
{
* Obtains a substring matching the nth set of parenthesis from the pattern.
* See numSubs(void), or null if the nth backrefence did not match.
*/
- public String stringMatched(int i)
+ public String stringMatchedI(int i)
{
- int mf = matchedFrom(i), cm = charsMatched(i);
+ int mf = matchedFromI(i), cm = charsMatchedI(i);
return !didMatch_ || mf < 0 || cm < 0 ? null : src.substring(mf, mf
+ cm);
}
* This returns the part of the string that follows the ith backreference, or
* null if the backreference did not match.
*/
- public String left(int i)
+ public String leftI(int i)
{
- int mf = matchedFrom(i);
+ int mf = matchedFromI(i);
return !didMatch_ || (mf < 0) ? null : src.substring(0, mf);
}
* This returns the string to the right of the ith backreference, or null if
* the backreference did not match.
*/
- public String right(int i)
+ public String rightI(int i)
{
- int mf = matchedFrom(i), cm = charsMatched(i);
+ int mf = matchedFromI(i), cm = charsMatchedI(i);
return !didMatch_ || mf < 0 || cm < 0 ? null : src.substring(mf + cm,
src.length());
}
}
/** An older name for matchedFrom. */
- public int matchFrom(int i)
+ public int matchFromI(int i)
{
- return matchedFrom(i);
+ return matchedFromI(i);
}
/** An older name for stringMatched. */
- public String substring(int i)
+ public String substringI(int i)
{
- return stringMatched(i);
+ return stringMatchedI(i);
}
}