public boolean endsWith(CharSequence suffix, int toffset) { int prefixSz = suffix.length(); if (0 == prefixSz) { return true; } int matchStart = length() - toffset; if (matchStart < prefixSz) { return false; } for (int i = toInternalId(matchStart - 1), j = prefixSz - 1; j >= 0; --i, --j) { char c0 = buf[i]; char c1 = suffix.charAt(j); if (c0 != c1) { return false; } } return true; }
public boolean endsWith(CharSequence suffix, int toffset) { int prefixSz = suffix.length(); if (0 == prefixSz) { return true; } int matchStart = length() - toffset; if (matchStart < prefixSz) { return false; } for (int i = toInternalId(matchStart - 1), j = prefixSz - 1; j >= 0; --i, --j) { char c0 = buf[i]; char c1 = suffix.charAt(j); if (c0 != c1) { return false; } } return true; }
@Override public boolean endsWith(FastStr prefix, int toffset) { int prefixSz = prefix.length(); if (0 == prefixSz) { return true; } int matchStart = length() - toffset; if (matchStart < prefixSz) { return false; } char[] prefixBuf = prefix.buf; for (int i = toInternalId(matchStart - 1), j = prefix.toInternalId(prefixSz - 1); j >= prefix.begin; --i, --j) { char c0 = buf[i]; char c1 = prefixBuf[j]; if (c0 != c1) { return false; } } return true; }
@Override public boolean endsWith(FastStr prefix, int toffset) { int prefixSz = prefix.length(); if (0 == prefixSz) { return true; } int matchStart = length() - toffset; if (matchStart < prefixSz) { return false; } char[] prefixBuf = prefix.buf; for (int i = toInternalId(matchStart - 1), j = prefix.toInternalId(prefixSz - 1); j >= prefix.begin; --i, --j) { char c0 = buf[i]; char c1 = prefixBuf[j]; if (c0 != c1) { return false; } } return true; }
if (oldChar != newChar) { char[] val = this.buf; /* avoid getfield opcode */ int len = length(); int i = begin - 1;
if (oldChar != newChar) { char[] val = this.buf; /* avoid getfield opcode */ int len = length(); int i = begin - 1;
private static int nextNonSeparator(FastStr str, int start) { int sz = str.length(); int pos = start; while (pos < sz) { char ch = str.charAt(pos); if (isSeparator(ch)) { pos++; } else { break; } } return pos; }
private static int nextNonSeparator(FastStr str, int start) { int sz = str.length(); int pos = start; while (pos < sz) { char ch = str.charAt(pos); if (isSeparator(ch)) { pos++; } else { break; } } return pos; }
|| (toffset > (long) length() - len) || (ooffset > (long) other.length - len)) { return false;
|| (toffset > (long) length() - len) || (ooffset > (long) other.length - len)) { return false;
private static String typeDesc(BeanSpec spec) { String root = classDesc(spec.rawType()); List<java.lang.reflect.Type> typeParams = spec.typeParams(); if (typeParams.isEmpty()) { return root; } StringBuilder sb = S.builder("<"); for (java.lang.reflect.Type type : typeParams) { BeanSpec specx = BeanSpec.of(type, null, spec.injector()); sb.append(typeDesc(specx)); } sb.append(">"); FastStr str = FastStr.of(root); str = str.take(str.length() - 1).append(sb.toString()).append(";"); return str.toString(); } private static String classDesc(Class c) { if (c.isPrimitive()) { c = $.wrapperClassOf(c); } return Type.getDescriptor(c); }
public int lastIndexOf(int ch, int fromIndex) { fromIndex = toInternalId(fromIndex); if (ch < Character.MIN_SUPPLEMENTARY_CODE_POINT) { // handle most cases here (ch is a BMP code point or a // negative value (invalid code point)) final char[] value = this.buf; int i = Math.min(fromIndex, length() - 1 + begin); for (; i >= begin; i--) { if (value[i] == ch) { return toExternalId(i); } } return -1; } else { return toExternalId(lastIndexOfSupplementary(ch, fromIndex)); } }
public int lastIndexOf(int ch, int fromIndex) { fromIndex = toInternalId(fromIndex); if (ch < Character.MIN_SUPPLEMENTARY_CODE_POINT) { // handle most cases here (ch is a BMP code point or a // negative value (invalid code point)) final char[] value = this.buf; int i = Math.min(fromIndex, length() - 1 + begin); for (; i >= begin; i--) { if (value[i] == ch) { return toExternalId(i); } } return -1; } else { return toExternalId(lastIndexOfSupplementary(ch, fromIndex)); } }
private static int locateNextStop(FastStr str, int start) { final int sz = str.length(); if (start >= sz - 1) { return -1;
private $.T2<String, String> splitActionStr(String action) { FastStr fs = FastStr.of(action); FastStr fs1 = fs.beforeFirst(':'); FastStr fs2 = fs1.isEmpty() ? fs : fs.substr(fs1.length() + 1); return $.T2(fs1.trim().toString(), fs2.trim().toString()); }
private $.T2<String, String> splitActionStr(String action) { FastStr fs = FastStr.of(action); FastStr fs1 = fs.beforeFirst(':'); FastStr fs2 = fs1.isEmpty() ? fs : fs.substr(fs1.length() + 1); return $.T2(fs1.trim().toString(), fs2.trim().toString()); }
private String typeDesc(BeanSpec spec) { String root = classDesc(spec.rawType()); List<java.lang.reflect.Type> typeParams = spec.typeParams(); if (typeParams.isEmpty()) { return root; } S.Buffer sb = S.newBuffer("<"); for (java.lang.reflect.Type type : typeParams) { BeanSpec specx = BeanSpec.of(type, null, spec.injector(), typeParamLookup); sb.append(typeDesc(specx)); } sb.append(">"); FastStr str = FastStr.of(root); str = str.take(str.length() - 1).append(sb.toString()).append(";"); return str.toString(); }
private String typeDesc(BeanSpec spec) { String root = classDesc(spec.rawType()); List<java.lang.reflect.Type> typeParams = spec.typeParams(); if (typeParams.isEmpty()) { return root; } S.Buffer sb = S.newBuffer("<"); for (java.lang.reflect.Type type : typeParams) { BeanSpec specx = BeanSpec.of(type, null, spec.injector(), typeParamLookup); sb.append(typeDesc(specx)); } sb.append(">"); FastStr str = FastStr.of(root); str = str.take(str.length() - 1).append(sb.toString()).append(";"); return str.toString(); }
private void init(CharSequence chars) { final FastStr fs = FastStr.of(chars); final int sz = fs.length(); int last = nextNonSeparator(fs, 0); int pos; while (true) { pos = locateNextStop(fs, last); if (pos < 0 || pos == sz) { FastStr sub = fs.substr(last); if (!sub.isEmpty()) { list.add(sub.toLowerCase()); } break; } FastStr sub = fs.subSequence(last, pos); if (!sub.isEmpty()) { list.add(sub.toLowerCase()); } last = nextNonSeparator(fs, pos); } }
private void init(CharSequence chars) { final FastStr fs = FastStr.of(chars); final int sz = fs.length(); int last = nextNonSeparator(fs, 0); int pos; while (true) { pos = locateNextStop(fs, last); if (pos < 0 || pos == sz) { FastStr sub = fs.substr(last); if (!sub.isEmpty()) { list.add(sub.toLowerCase()); } break; } FastStr sub = fs.subSequence(last, pos); if (!sub.isEmpty()) { list.add(sub.toLowerCase()); } last = nextNonSeparator(fs, pos); } }