private final boolean checkEnds(final int sipat, final boolean isSingleStart) { // if the remaining length of the string isn't the same as that found in the pattern // we do not match final int l = lpat - sipat; // calculate length of comparison final int ostr = lstr - l; // calculate offset into string if (ostr >= 0 && strncmp(apat, sipat, astr, ostr, l)) { if (isSingleStart) { // if the ends matches make sure there isn't a PATHSEP in the candidate string // part int i = ostr - istr; while (i > istr) { if (astr[--i] == PATHSEP) { return false; // we cannot match because of a PATHSEP in the matched // part } } } add(new String(astr, istr, ostr - istr)); return true; } // otherwise we do not match return false; } }
scanLiteralPrefix(); add(""); add(new String(astr, istr, lstr - istr)); return checkEnds(sipat, false); while (istr < eistr && !strncmp(apat, sipat, astr, eistr, l)) add(new String(astr, istr, eistr - istr)); istr = eistr + l; add(new String(astr, sistr, lstr - sistr)); return checkEnds(sipat, true); final int sistr = istr; while (istr < lstr && !strncmp(apat, sipat, astr, istr, l)) add(new String(astr, sistr, istr - sistr)); ipat++; istr += l; return match();
scanLiteralPrefix(); add(""); add(new String(astr, istr, lstr - istr)); return checkEnds(sipat, false); while (istr < eistr && !strncmp(apat, sipat, astr, eistr, l)) add(new String(astr, istr, eistr - istr)); istr = eistr + l; add(new String(astr, sistr, lstr - sistr)); return checkEnds(sipat, true); final int sistr = istr; while (istr < lstr && !strncmp(apat, sipat, astr, istr, l)) add(new String(astr, sistr, istr - sistr)); ipat++; istr += l; return match();
scanLiteralPrefix(); add(""); add(new String(astr, istr, lstr - istr)); return checkEnds(sipat, false); while (istr < eistr && !strncmp(apat, sipat, astr, eistr, l)) add(new String(astr, istr, eistr - istr)); istr = eistr + l; add(new String(astr, sistr, lstr - sistr)); return checkEnds(sipat, true); final int sistr = istr; while (istr < lstr && !strncmp(apat, sipat, astr, istr, l)) add(new String(astr, sistr, istr - sistr)); ipat++; istr += l; return match();
scanLiteralPrefix(); add(""); add(new String(astr, istr, lstr - istr)); return checkEnds(sipat, false); while (istr < eistr && !strncmp(apat, sipat, astr, eistr, l)) add(new String(astr, istr, eistr - istr)); istr = eistr + l; add(new String(astr, sistr, lstr - sistr)); return checkEnds(sipat, true); final int sistr = istr; while (istr < lstr && !strncmp(apat, sipat, astr, istr, l)) add(new String(astr, sistr, istr - sistr)); ipat++; istr += l; return match();
private boolean checkEnds(final int sipat, final boolean isSingleStart) { // if the remaining length of the string isn't the same as that found in the pattern // we do not match final int l = lpat - sipat; // calculate length of comparison final int ostr = lstr - l; // calculate offset into string if (ostr >= 0 && strncmp(apat, sipat, astr, ostr, l)) { if (isSingleStart) { // if the ends matches make sure there isn't a PATHSEP in the candidate string // part int i = ostr - istr; while (i > istr) { if (astr[--i] == PATHSEP) { return false; // we cannot match because of a PATHSEP in the matched // part } } } add(new String(astr, istr, ostr - istr)); return true; } // otherwise we do not match return false; } }
private final boolean checkEnds(final int sipat, final boolean isSingleStart) { // if the remaining length of the string isn't the same as that found in the pattern // we do not match final int l = lpat - sipat; // calculate length of comparison final int ostr = lstr - l; // calculate offset into string if (ostr >= 0 && strncmp(apat, sipat, astr, ostr, l)) { if (isSingleStart) { // if the ends matches make sure there isn't a PATHSEP in the candidate string // part int i = ostr - istr; while (i > istr) { if (astr[--i] == PATHSEP) { return false; // we cannot match because of a PATHSEP in the matched // part } } } add(new String(astr, istr, ostr - istr)); return true; } // otherwise we do not match return false; } }
private boolean checkEnds(final int sipat, final boolean isSingleStart) { // if the remaining length of the string isn't the same as that found in the pattern // we do not match final int l = lpat - sipat; // calculate length of comparison final int ostr = lstr - l; // calculate offset into string if (ostr >= 0 && strncmp(apat, sipat, astr, ostr, l)) { if (isSingleStart) { // if the ends matches make sure there isn't a PATHSEP in the candidate string // part int i = ostr - istr; while (i > istr) { if (astr[--i] == PATHSEP) { return false; // we cannot match because of a PATHSEP in the matched // part } } } add(new String(astr, istr, ostr - istr)); return true; } // otherwise we do not match return false; } }