public override int Matches(int stringIndex, String testString, MatchResultImpl matchResult) { int end = matchResult.GetEnd(groupIndex); matchResult.SetEnd(groupIndex, stringIndex); int shift = next.Matches(stringIndex, testString, matchResult); /* * if(shift >=0 && matchResult.getEnd(groupIndex) == -1) { * matchResult.setEnd(groupIndex, stringIndex); } */ if (shift < 0) { matchResult.SetEnd(groupIndex, end); } return(shift); }
public override int Matches(int stringIndex, String testString, MatchResultImpl matchResult) { if (matchResult.Mode() == Matcher.MODE_FIND || stringIndex == matchResult.GetRightBound()) { matchResult.SetValid(); matchResult.SetEnd(0, stringIndex); return(stringIndex); } return(-1); }