Lines Matching defs:end

57     public SpannableStringBuilder(CharSequence text, int start, int end) {
58 int srclen = end - start;
66 TextUtils.getChars(text, start, end, mText, 0);
81 Object[] spans = sp.getSpans(start, end, Object.class);
94 if (st > end - start)
95 st = end - start;
99 if (en > end - start)
100 en = end - start;
185 int end = mSpanEnds[i];
198 if (end > mGapStart)
199 end -= mGapLength;
200 if (end > where)
201 end += mGapLength;
202 else if (end == where) {
206 end += mGapLength;
210 mSpanEnds[i] = end;
219 public SpannableStringBuilder insert(int where, CharSequence tb, int start, int end) {
220 return replace(where, where, tb, start, end);
229 public SpannableStringBuilder delete(int start, int end) {
230 SpannableStringBuilder ret = replace(start, end, "", 0, 0);
289 public SpannableStringBuilder append(CharSequence text, int start, int end) {
291 return replace(length, length, text, start, end);
300 private boolean removeSpansForChange(int start, int end, boolean textIsRemoved, int i) {
304 removeSpansForChange(start, end, textIsRemoved, leftChild(i))) {
319 return resolveGap(mSpanStarts[i]) <= end && (i & 1) != 0 &&
320 removeSpansForChange(start, end, textIsRemoved, rightChild(i));
325 private void change(int start, int end, CharSequence cs, int csStart, int csEnd) {
327 final int replacedLength = end - start;
346 if (spanStart > start && spanStart <= end) {
347 for (spanStart = end; spanStart < clen; spanStart++)
348 if (spanStart > end && charAt(spanStart - 1) == '\n')
352 if (spanEnd > start && spanEnd <= end) {
353 for (spanEnd = end; spanEnd < clen; spanEnd++)
354 if (spanEnd > end && charAt(spanEnd - 1) == '\n')
366 else if (spanStart == end + nbNewChars) flags |= SPAN_START_AT_END;
368 else if (spanEnd == end + nbNewChars) flags |= SPAN_END_AT_END;
375 moveGapTo(end);
386 removeSpansForChange(start, end, textIsRemoved, treeRoot())) {
451 // A POINT located inside the replaced range should be moved to the end of the
465 // the end of the range (which will be < mGapStart + mGapLength since mGapLength
466 // is > 0, which should stay 'unchanged' at the end of the replaced text.
470 // Move to the end of replaced text (needed if nbNewChars != 0)
484 int end = mSpanEnds[i];
487 if (end > mGapStart) end -= mGapLength;
504 sendSpanRemoved(object, start, end);
508 public SpannableStringBuilder replace(int start, int end, CharSequence tb) {
509 return replace(start, end, tb, 0, tb.length());
513 public SpannableStringBuilder replace(final int start, final int end,
515 checkRange("replace", start, end);
519 CharSequence repl = mFilters[i].filter(tb, tbstart, tbend, this, start, end);
528 final int origLen = end - start;
551 change(start, end, tb, tbstart, tbend);
555 if (selectionStart > start && selectionStart < end) {
564 if (selectionEnd > start && selectionEnd < end) {
582 sendToSpanWatchers(start, end, newLen - origLen);
674 * inserted at the start or end of the span's range.
676 public void setSpan(Object what, int start, int end, int flags) {
677 setSpan(true, what, start, end, flags);
683 private void setSpan(boolean send, Object what, int start, int end, int flags) {
684 checkRange("setSpan", start, end);
692 if(isInvalidParagraphEnd(end, flagsEnd)) {
693 throw new RuntimeException("PARAGRAPH span must end at paragraph boundary");
697 if (flagsStart == POINT && flagsEnd == MARK && start == end) {
708 int nend = end;
717 if (end > mGapStart) {
718 end += mGapLength;
719 } else if (end == mGapStart) {
720 if (flagsEnd == POINT || (flagsEnd == PARAGRAPH && end == length()))
721 end += mGapLength;
737 mSpanEnds[i] = end;
751 mSpanEnds = GrowingArrayUtils.append(mSpanEnds, mSpanCount, end);
782 private final boolean isInvalidParagraphEnd(int end, int flagsEnd) {
784 if (end != 0 && end != length()) {
785 char c = charAt(end - 1);
822 * Return the buffer offset of the end of the specified
832 * Return the flags of the end of the specified
1138 public CharSequence subSequence(int start, int end) {
1139 return new SpannableStringBuilder(this, start, end);
1146 public void getChars(int start, int end, char[] dest, int destoff) {
1147 checkRange("getChars", start, end);
1149 if (end <= mGapStart) {
1150 System.arraycopy(mText, start, dest, destoff, end - start);
1152 System.arraycopy(mText, start + mGapLength, dest, destoff, end - start);
1157 end - mGapStart);
1175 * [start, end[ range.
1178 public String substring(int start, int end) {
1179 char[] buf = new char[end - start];
1180 getChars(start, end, buf, 0);
1223 private void sendSpanAdded(Object what, int start, int end) {
1224 SpanWatcher[] recip = getSpans(start, end, SpanWatcher.class);
1228 recip[i].onSpanAdded(this, what, start, end);
1232 private void sendSpanRemoved(Object what, int start, int end) {
1233 SpanWatcher[] recip = getSpans(start, end, SpanWatcher.class);
1237 recip[i].onSpanRemoved(this, what, start, end);
1241 private void sendSpanChanged(Object what, int oldStart, int oldEnd, int start, int end) {
1245 Math.min(Math.max(oldEnd, end), length()), SpanWatcher.class);
1248 spanWatchers[i].onSpanChanged(this, what, oldStart, oldEnd, start, end);
1252 private static String region(int start, int end) {
1253 return "(" + start + " ... " + end + ")";
1256 private void checkRange(final String operation, int start, int end) {
1257 if (end < start) {
1259 region(start, end) + " has end before start");
1264 if (start > len || end > len) {
1266 region(start, end) + " ends beyond length " + len);
1269 if (start < 0 || end < 0) {
1271 region(start, end) + " starts before 0");
1360 public void drawText(Canvas c, int start, int end, float x, float y, Paint p) {
1361 checkRange("drawText", start, end);
1363 if (end <= mGapStart) {
1364 c.drawText(mText, start, end - start, x, y, p);
1366 c.drawText(mText, start + mGapLength, end - start, x, y, p);
1368 char[] buf = TextUtils.obtain(end - start);
1370 getChars(start, end, buf, 0);
1371 c.drawText(buf, 0, end - start, x, y, p);
1381 public void drawTextRun(Canvas c, int start, int end, int contextStart, int contextEnd,
1383 checkRange("drawTextRun", start, end);
1386 int len = end - start;
1404 public float measureText(int start, int end, Paint p) {
1405 checkRange("measureText", start, end);
1409 if (end <= mGapStart) {
1410 ret = p.measureText(mText, start, end - start);
1412 ret = p.measureText(mText, start + mGapLength, end - start);
1414 char[] buf = TextUtils.obtain(end - start);
1416 getChars(start, end, buf, 0);
1417 ret = p.measureText(buf, 0, end - start);
1428 public int getTextWidths(int start, int end, float[] widths, Paint p) {
1429 checkRange("getTextWidths", start, end);
1433 if (end <= mGapStart) {
1434 ret = p.getTextWidths(mText, start, end - start, widths);
1436 ret = p.getTextWidths(mText, start + mGapLength, end - start, widths);
1438 char[] buf = TextUtils.obtain(end - start);
1440 getChars(start, end, buf, 0);
1441 ret = p.getTextWidths(buf, 0, end - start, widths);
1452 public float getTextRunAdvances(int start, int end, int contextStart, int contextEnd, boolean isRtl,
1458 int len = end - start;
1460 if (end <= mGapStart) {
1492 * @param contextEnd the (non-inclusive) end index of the context
1591 // The spans (along with start and end offsets and flags) are stored in linear arrays sorted
1633 // descendants of index < n. In these cases, it simply represents the maximum span end of its
1662 int end = mSpanEnds[i];
1676 mSpanEnds[j] = end;
1683 // invariant 2: max is max span end for each node and its descendants