Javolution 6.0.0 java
Text.java
Go to the documentation of this file.
1 /*
2  * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
3  * Copyright (C) 2012 - Javolution (http://javolution.org/)
4  * All rights reserved.
5  *
6  * Permission to use, copy, modify, and distribute this software is
7  * freely granted, provided that this notice is preserved.
8  */
9 package javolution.text;
10 
11 import java.io.PrintStream;
12 
13 import javolution.lang.MathLib;
14 import javolution.lang.Realtime;
16 import javolution.util.FastMap;
19 
60 @Realtime
61 public final class Text implements CharSequence, Comparable<CharSequence>,
62  XMLSerializable, ValueType<Text> {
63 
64  private static final long serialVersionUID = 0x600L; // Version.
65 
69  private static final int BLOCK_SIZE = 1 << 5;
70 
74  private static final int BLOCK_MASK = ~(BLOCK_SIZE - 1);
75 
79  private static final FastMap<Text, Text> INTERN = new FastMap<Text, Text>()
80  .shared();
81 
85  public static final Text EMPTY = new Text("").intern();
86 
90  private final char[] _data;
91 
95  private int _count;
96 
100  private Text _head;
101 
105  private Text _tail;
106 
112  private Text(boolean isPrimitive) {
113  _data = isPrimitive ? new char[BLOCK_SIZE] : null;
114  }
115 
122  public Text(String str) {
123  this(str.length() <= BLOCK_SIZE);
124  _count = str.length();
125  if (_data != null) { // Primitive.
126  str.getChars(0, _count, _data, 0);
127  } else { // Composite, splits on a block boundary.
128  int half = ((_count + BLOCK_SIZE) >> 1) & BLOCK_MASK;
129  _head = new Text(str.substring(0, half));
130  _tail = new Text(str.substring(half, _count));
131  }
132  }
133 
140  public static Text valueOf(Object obj) {
141  return new TextBuilder().append(obj).toText();
142  }
143 
144  private static Text valueOf(String str) {
145  return Text.valueOf(str, 0, str.length());
146  }
147 
148  private static Text valueOf(String str, int start, int end) {
149  int length = end - start;
150  if (length <= BLOCK_SIZE) {
151  Text text = newPrimitive(length);
152  str.getChars(start, end, text._data, 0);
153  return text;
154  } else { // Splits on a block boundary.
155  int half = ((length + BLOCK_SIZE) >> 1) & BLOCK_MASK;
156  return newComposite(Text.valueOf(str, start, start + half),
157  Text.valueOf(str, start + half, end));
158  }
159  }
160 
168  public static Text valueOf(char[] chars) {
169  return Text.valueOf(chars, 0, chars.length);
170  }
171 
183  public static Text valueOf(char[] chars, int offset, int length) {
184  if ((offset < 0) || (length < 0) || ((offset + length) > chars.length))
185  throw new IndexOutOfBoundsException();
186  if (length <= BLOCK_SIZE) {
187  Text text = Text.newPrimitive(length);
188  System.arraycopy(chars, offset, text._data, 0, length);
189  return text;
190  } else { // Splits on a block boundary.
191  int half = ((length + BLOCK_SIZE) >> 1) & BLOCK_MASK;
192  return Text.newComposite(Text.valueOf(chars, offset, half),
193  Text.valueOf(chars, offset + half, length - half));
194  }
195  }
196 
205  static Text valueOf(TextBuilder tb, int start, int end) {
206  int length = end - start;
207  if (length <= BLOCK_SIZE) {
208  Text text = Text.newPrimitive(length);
209  tb.getChars(start, end, text._data, 0);
210  return text;
211  } else { // Splits on a block boundary.
212  int half = ((length + BLOCK_SIZE) >> 1) & BLOCK_MASK;
213  return Text.newComposite(Text.valueOf(tb, start, start + half),
214  Text.valueOf(tb, start + half, end));
215  }
216  }
217 
226  public static Text valueOf(boolean b) {
227  return b ? TRUE : FALSE;
228  }
229 
230  private static final Text TRUE = new Text("true").intern();
231 
232  private static final Text FALSE = new Text("false").intern();
233 
240  public static Text valueOf(char c) {
241  Text text = Text.newPrimitive(1);
242  text._data[0] = c;
243  return text;
244  }
245 
253  public static Text valueOf(int i) {
254  TextBuilder tb = new TextBuilder();
255  return tb.append(i).toText();
256  }
257 
266  public static Text valueOf(int i, int radix) {
267  TextBuilder tb = new TextBuilder();
268  return tb.append(i, radix).toText();
269  }
270 
278  public static Text valueOf(long l) {
279  TextBuilder tb = new TextBuilder();
280  return tb.append(l).toText();
281  }
282 
291  public static Text valueOf(long l, int radix) {
292  TextBuilder tb = new TextBuilder();
293  return tb.append(l, radix).toText();
294  }
295 
303  public static Text valueOf(float f) {
304  TextBuilder tb = new TextBuilder();
305  return tb.append(f).toText();
306  }
307 
315  public static Text valueOf(double d) {
316  TextBuilder tb = new TextBuilder();
317  return tb.append(d).toText();
318  }
319 
335  public static Text valueOf(double d, int digits, boolean scientific,
336  boolean showZero) {
337  TextBuilder tb = new TextBuilder();
338  return tb.append(d, digits, scientific, showZero).toText();
339  }
340 
346  public int length() {
347  return _count;
348  }
349 
357  public Text plus(Object obj) {
358  return this.concat(Text.valueOf(obj));
359  }
360 
368  public Text plus(String str) {
369 
370  Text merge = this.append(str);
371  return merge != null ? merge : concat(Text.valueOf(str));
372  }
373 
374  private Text append(String str) { // Try to append, returns null if cannot.
375  int length = str.length();
376  if (_data == null) {
377  Text merge = _tail.append(str);
378  return merge != null ? Text.newComposite(_head, merge) : null;
379  } else { // Primitive.
380  if (_count + length > BLOCK_SIZE)
381  return null; // Cannot merge.
382  Text text = Text.newPrimitive(_count + length);
383  System.arraycopy(_data, 0, text._data, 0, _count);
384  str.getChars(0, length, text._data, _count);
385  return text;
386  }
387  }
388 
398  public Text concat(Text that) {
399  // All Text instances are maintained balanced:
400  // (head < tail * 2) & (tail < head * 2)
401 
402  final int length = this._count + that._count;
403  if (length <= BLOCK_SIZE) { // Merges to primitive.
404  Text text = Text.newPrimitive(length);
405  this.getChars(0, this._count, text._data, 0);
406  that.getChars(0, that._count, text._data, this._count);
407  return text;
408 
409  } else { // Returns a composite.
410  Text head = this;
411  Text tail = that;
412 
413  if (((head._count << 1) < tail._count) && (tail._data == null)) { // tail is composite
414  // head too small, returns (head + tail/2) + (tail/2)
415  if (tail._head._count > tail._tail._count) {
416  // Rotates to concatenate with smaller part.
417  tail = tail.rightRotation();
418  }
419  head = head.concat(tail._head);
420  tail = tail._tail;
421 
422  } else if (((tail._count << 1) < head._count)
423  && (head._data == null)) { // head is composite.
424  // tail too small, returns (head/2) + (head/2 concat tail)
425  if (head._tail._count > head._head._count) {
426  // Rotates to concatenate with smaller part.
427  head = head.leftRotation();
428  }
429  tail = head._tail.concat(tail);
430  head = head._head;
431  }
432  return Text.newComposite(head, tail);
433  }
434  }
435 
436  private Text rightRotation() {
437  // See: http://en.wikipedia.org/wiki/Tree_rotation
438  Text P = this._head;
439  if (P._data != null)
440  return this; // Head not a composite, cannot rotate.
441  Text A = P._head;
442  Text B = P._tail;
443  Text C = this._tail;
444  return Text.newComposite(A, Text.newComposite(B, C));
445  }
446 
447  private Text leftRotation() {
448  // See: http://en.wikipedia.org/wiki/Tree_rotation
449  Text Q = this._tail;
450  if (Q._data != null)
451  return this; // Tail not a composite, cannot rotate.
452  Text B = Q._head;
453  Text C = Q._tail;
454  Text A = this._head;
455  return Text.newComposite(Text.newComposite(A, B), C);
456  }
457 
466  public Text subtext(int start) {
467  return subtext(start, length());
468  }
469 
480  public Text insert(int index, Text txt) {
481  return subtext(0, index).concat(txt).concat(subtext(index));
482  }
483 
493  public Text delete(int start, int end) {
494  if (start > end)
495  throw new IndexOutOfBoundsException();
496  return subtext(0, start).concat(subtext(end));
497  }
498 
507  public Text replace(java.lang.CharSequence target,
508  java.lang.CharSequence replacement) {
509  int i = indexOf(target);
510  return (i < 0) ? this : // No target sequence found.
511  subtext(0, i).concat(Text.valueOf(replacement)).concat(
512  subtext(i + target.length()).replace(target,
513  replacement));
514  }
515 
524  public Text replace(CharSet charSet, java.lang.CharSequence replacement) {
525  int i = indexOfAny(charSet);
526  return (i < 0) ? this : // No character to replace.
527  subtext(0, i).concat(Text.valueOf(replacement)).concat(
528  subtext(i + 1).replace(charSet, replacement));
529  }
530 
540  public java.lang.CharSequence subSequence(int start, int end) {
541  return subtext(start, end);
542  }
543 
552  public int indexOf(java.lang.CharSequence csq) {
553  return indexOf(csq, 0);
554  }
555 
567  public int indexOf(java.lang.CharSequence csq, int fromIndex) {
568 
569  // Limit cases.
570  final int csqLength = csq.length();
571  final int min = Math.max(0, fromIndex);
572  final int max = _count - csqLength;
573  if (csqLength == 0) { return (min > max) ? -1 : min; }
574 
575  // Searches for csq.
576  final char c = csq.charAt(0);
577  for (int i = indexOf(c, min); (i >= 0) && (i <= max); i = indexOf(c,
578  ++i)) {
579  boolean match = true;
580  for (int j = 1; j < csqLength; j++) {
581  if (this.charAt(i + j) != csq.charAt(j)) {
582  match = false;
583  break;
584  }
585  }
586  if (match) { return i; }
587  }
588  return -1;
589  }
590 
599  public int lastIndexOf(java.lang.CharSequence csq) {
600  return lastIndexOf(csq, _count);
601  }
602 
613  public int lastIndexOf(java.lang.CharSequence csq, int fromIndex) {
614 
615  // Limit cases.
616  final int csqLength = csq.length();
617  final int min = 0;
618  final int max = Math.min(fromIndex, _count - csqLength);
619  if (csqLength == 0) { return (min > max) ? -1 : max; }
620 
621  // Searches for csq.
622  final char c = csq.charAt(0);
623  for (int i = lastIndexOf(c, max); (i >= 0); i = lastIndexOf(c, --i)) {
624  boolean match = true;
625  for (int j = 1; j < csqLength; j++) {
626  if (this.charAt(i + j) != csq.charAt(j)) {
627  match = false;
628  break;
629  }
630  }
631  if (match) { return i; }
632  }
633  return -1;
634 
635  }
636 
645  public boolean startsWith(java.lang.CharSequence prefix) {
646  return startsWith(prefix, 0);
647  }
648 
657  public boolean endsWith(java.lang.CharSequence suffix) {
658  return startsWith(suffix, length() - suffix.length());
659  }
660 
669  public boolean startsWith(java.lang.CharSequence prefix, int index) {
670  final int prefixLength = prefix.length();
671  if ((index >= 0) && (index <= (this.length() - prefixLength))) {
672  for (int i = 0, j = index; i < prefixLength;) {
673  if (prefix.charAt(i++) != this.charAt(j++)) { return false; }
674  }
675  return true;
676  } else {
677  return false;
678  }
679  }
680 
689  public Text trim() {
690  int first = 0; // First character index.
691  int last = length() - 1; // Last character index.
692  while ((first <= last) && (charAt(first) <= ' ')) {
693  first++;
694  }
695  while ((last >= first) && (charAt(last) <= ' ')) {
696  last--;
697  }
698  return subtext(first, last + 1);
699  }
700 
707  public Text intern() {
708  Text txt = INTERN.putIfAbsent(this, this);
709  return txt == null ? this : txt;
710  }
711 
720  public boolean contentEquals(java.lang.CharSequence csq) {
721  if (csq.length() != _count)
722  return false;
723  for (int i = 0; i < _count;) {
724  if (this.charAt(i) != csq.charAt(i++))
725  return false;
726  }
727  return true;
728  }
729 
738  public boolean contentEqualsIgnoreCase(java.lang.CharSequence csq) {
739  if (this._count != csq.length())
740  return false;
741  for (int i = 0; i < _count;) {
742  char u1 = this.charAt(i);
743  char u2 = csq.charAt(i++);
744  if (u1 != u2) {
745  u1 = Character.toUpperCase(u1);
746  u2 = Character.toUpperCase(u2);
747  if ((u1 != u2)
748  && (Character.toLowerCase(u1) != Character
749  .toLowerCase(u2)))
750  return false;
751 
752  }
753  }
754  return true;
755  }
756 
768  @Override
769  public boolean equals(Object obj) {
770  if (this == obj)
771  return true;
772  if (!(obj instanceof Text))
773  return false;
774  final Text that = (Text) obj;
775  if (this._count != that._count)
776  return false;
777  for (int i = 0; i < _count;) {
778  if (this.charAt(i) != that.charAt(i++))
779  return false;
780  }
781  return true;
782  }
783 
789  @Override
790  public int hashCode() {
791  int h = 0;
792  final int length = this.length();
793  for (int i = 0; i < length;) {
794  h = 31 * h + charAt(i++);
795  }
796  return h;
797  }
798 
808  public int compareTo(CharSequence csq) {
809  return Equalities.LEXICAL.compare(this, csq);
810  }
811 
818  public Text toText() {
819  return this;
820  }
821 
827  public void printStatistics(PrintStream out) {
828  int length = this.length();
829  int leaves = getNbrOfLeaves();
830  synchronized (out) {
831  out.print("LENGTH: " + length());
832  out.print(", MAX DEPTH: " + getDepth());
833  out.print(", NBR OF BRANCHES: " + getNbrOfBranches());
834  out.print(", NBR OF LEAVES: " + leaves);
835  out.print(", AVG LEAVE LENGTH: " + (length + (leaves >> 1))
836  / leaves);
837  out.println();
838  }
839  }
840 
841  private int getDepth() {
842  if (_data != null) // Primitive.
843  return 0;
844  return MathLib.max(_head.getDepth(), _tail.getDepth()) + 1;
845  }
846 
847  private int getNbrOfBranches() {
848  return (_data == null) ? _head.getNbrOfBranches()
849  + _tail.getNbrOfBranches() + 1 : 0;
850  }
851 
852  private int getNbrOfLeaves() {
853  return (_data == null) ? _head.getNbrOfLeaves()
854  + _tail.getNbrOfLeaves() : 1;
855  }
856 
863  public Text toLowerCase() {
864  if (_data == null) // Composite.
866  Text text = Text.newPrimitive(_count);
867  for (int i = 0; i < _count;) {
868  text._data[i] = Character.toLowerCase(_data[i++]);
869  }
870  return text;
871  }
872 
879  public Text toUpperCase() {
880  if (_data == null) // Composite.
882  Text text = Text.newPrimitive(_count);
883  for (int i = 0; i < _count;) {
884  text._data[i] = Character.toUpperCase(_data[i++]);
885  }
886  return text;
887  }
888 
897  public char charAt(int index) {
898  if (index >= _count)
899  throw new IndexOutOfBoundsException();
900  return (_data != null) ? _data[index] : (index < _head._count) ? _head
901  .charAt(index) : _tail.charAt(index - _head._count);
902  }
903 
913  public int indexOf(char c) {
914  return indexOf(c, 0);
915  }
916 
927  public int indexOf(char c, int fromIndex) {
928  if (_data != null) { // Primitive.
929  for (int i = MathLib.max(fromIndex, 0); i < _count; i++) {
930  if (_data[i] == c)
931  return i;
932  }
933  return -1;
934  } else { // Composite.
935  final int cesure = _head._count;
936  if (fromIndex < cesure) {
937  final int headIndex = _head.indexOf(c, fromIndex);
938  if (headIndex >= 0)
939  return headIndex; // Found in head.
940  }
941  final int tailIndex = _tail.indexOf(c, fromIndex - cesure);
942  return (tailIndex >= 0) ? tailIndex + cesure : -1;
943  }
944  }
945 
957  public int lastIndexOf(char c, int fromIndex) {
958  if (_data != null) { // Primitive.
959  for (int i = MathLib.min(fromIndex, _count - 1); i >= 0; i--) {
960  if (_data[i] == c)
961  return i;
962  }
963  return -1;
964  } else { // Composite.
965  final int cesure = _head._count;
966  if (fromIndex >= cesure) {
967  final int tailIndex = _tail.lastIndexOf(c, fromIndex - cesure);
968  if (tailIndex >= 0)
969  return tailIndex + cesure; // Found in tail.
970  }
971  return _head.lastIndexOf(c, fromIndex);
972  }
973  }
974 
985  public Text subtext(int start, int end) {
986  if (_data != null) { // Primitive.
987  if ((start < 0) || (start > end) || (end > _count))
988  throw new IndexOutOfBoundsException();
989  if ((start == 0) && (end == _count))
990  return this;
991  if (start == end)
992  return Text.EMPTY;
993  int length = end - start;
994  Text text = Text.newPrimitive(length);
995  System.arraycopy(_data, start, text._data, 0, length);
996  return text;
997  } else { // Composite.
998  final int cesure = _head._count;
999  if (end <= cesure)
1000  return _head.subtext(start, end);
1001  if (start >= cesure)
1002  return _tail.subtext(start - cesure, end - cesure);
1003  if ((start == 0) && (end == _count))
1004  return this;
1005  // Overlaps head and tail.
1006  return _head.subtext(start, cesure).concat(
1007  _tail.subtext(0, end - cesure));
1008  }
1009  }
1010 
1022  public void getChars(int start, int end, char dest[], int destPos) {
1023  if (_data != null) { // Primitive.
1024  if ((start < 0) || (end > _count) || (start > end))
1025  throw new IndexOutOfBoundsException();
1026  System.arraycopy(_data, start, dest, destPos, end - start);
1027  } else { // Composite.
1028  final int cesure = _head._count;
1029  if (end <= cesure) {
1030  _head.getChars(start, end, dest, destPos);
1031  } else if (start >= cesure) {
1032  _tail.getChars(start - cesure, end - cesure, dest, destPos);
1033  } else { // Overlaps head and tail.
1034  _head.getChars(start, cesure, dest, destPos);
1035  _tail.getChars(0, end - cesure, dest, destPos + cesure - start);
1036  }
1037  }
1038  }
1039 
1045  public String toString() {
1046  if (_data != null) { // Primitive.
1047  return new String(_data, 0, _count);
1048  } else { // Composite.
1049  char[] data = new char[_count];
1050  this.getChars(0, _count, data, 0);
1051  return new String(data, 0, _count);
1052  }
1053  }
1054 
1055  // Implements ValueType interface.
1056  public Text copy() {
1057  if (_data != null) { // Primitive.
1058  Text text = Text.newPrimitive(_count);
1059  System.arraycopy(_data, 0, text._data, 0, _count);
1060  return text;
1061  } else { // Composite.
1062  return Text.newComposite((Text) _head.copy(), (Text) _tail.copy());
1063  }
1064  }
1065 
1067  // Wilfried add-ons (methods provided by Microsoft .Net in C#)
1068  //
1078  public static Text valueOf(char c, int length) {
1079  if (length < 0)
1080  throw new IndexOutOfBoundsException();
1081  if (length <= BLOCK_SIZE) {
1082  Text text = Text.newPrimitive(length);
1083  for (int i = 0; i < length;) {
1084  text._data[i++] = c;
1085  }
1086  return text;
1087  } else {
1088  final int middle = (length >> 1);
1089  return Text.newComposite(Text.valueOf(c, middle),
1090  Text.valueOf(c, length - middle));
1091  }
1092  }
1093 
1100  public boolean isBlank() {
1101  return isBlank(0, length());
1102  }
1103 
1111  public boolean isBlank(int start, int length) {
1112  for (; start < length; start++) {
1113  if (charAt(start) > ' ')
1114  return false;
1115  }
1116  return true;
1117  }
1118 
1125  public Text trimStart() {
1126  int first = 0; // First character index.
1127  int last = length() - 1; // Last character index.
1128  while ((first <= last) && (charAt(first) <= ' ')) {
1129  first++;
1130  }
1131  return subtext(first, last + 1);
1132  }
1133 
1141  public Text trimEnd() {
1142  int first = 0; // First character index.
1143  int last = length() - 1; // Last character index.
1144  while ((last >= first) && (charAt(last) <= ' ')) {
1145  last--;
1146  }
1147  return subtext(first, last + 1);
1148  }
1149 
1160  public Text padLeft(int len) {
1161  return padLeft(len, ' ');
1162  }
1163 
1176  public Text padLeft(int len, char c) {
1177  final int padSize = (len <= length()) ? 0 : len - length();
1178  return insert(0, Text.valueOf(c, padSize));
1179  }
1180 
1191  public Text padRight(int len) {
1192  return padRight(len, ' ');
1193  }
1194 
1207  public Text padRight(int len, char c) {
1208  final int padSize = (len <= length()) ? 0 : len - length();
1209  return concat(Text.valueOf(c, padSize));
1210  }
1211 
1220  public int indexOfAny(CharSet charSet) {
1221  return indexOfAny(charSet, 0, length());
1222  }
1223 
1233  public int indexOfAny(CharSet charSet, int start) {
1234  return indexOfAny(charSet, start, length() - start);
1235  }
1236 
1247  public int indexOfAny(CharSet charSet, int start, int length) {
1248  final int stop = start + length;
1249  for (int i = start; i < stop; i++) {
1250  if (charSet.contains(charAt(i)))
1251  return i;
1252  }
1253  return -1;
1254  }
1255 
1264  public int lastIndexOfAny(CharSet charSet) {
1265  return lastIndexOfAny(charSet, 0, length());
1266  }
1267 
1277  public int lastIndexOfAny(CharSet charSet, int start) {
1278  return lastIndexOfAny(charSet, start, length() - start);
1279  }
1280 
1291  public int lastIndexOfAny(CharSet charSet, int start, int length) {
1292  for (int i = start + length; --i >= start;) {
1293  if (charSet.contains(charAt(i)))
1294  return i;
1295  }
1296  return -1;
1297  }
1298 
1299  //
1301 
1307  private static Text newPrimitive(int length) {
1308  Text text = new Text(true);
1309  text._count = length;
1310  return text;
1311  }
1312 
1320  private static Text newComposite(Text head, Text tail) {
1321  Text text = new Text(false);
1322  text._count = head._count + tail._count;
1323  text._head = head;
1324  text._tail = tail;
1325  return text;
1326  }
1327 
1328  @Override
1329  public Text value() {
1330  return this;
1331  }
1332 
1333 }
javolution.lang.MathLib.max
static int max(int x, int y)
Definition: MathLib.java:964
javolution.text.Text.length
int length()
Definition: Text.java:346
javolution.text.Text.BLOCK_MASK
static final int BLOCK_MASK
Definition: Text.java:74
javolution.text.Text.charAt
char charAt(int index)
Definition: Text.java:897
javolution.text.Text.Text
Text(String str)
Definition: Text.java:122
javolution.text.Text.toString
String toString()
Definition: Text.java:1045
javolution.text.Text.leftRotation
Text leftRotation()
Definition: Text.java:447
javolution.text.Text.newComposite
static Text newComposite(Text head, Text tail)
Definition: Text.java:1320
javolution.text.Text.rightRotation
Text rightRotation()
Definition: Text.java:436
javolution
javolution.text.Text.equals
boolean equals(Object obj)
Definition: Text.java:769
javolution.text.Text.contentEquals
boolean contentEquals(java.lang.CharSequence csq)
Definition: Text.java:720
javolution.text.Text.valueOf
static Text valueOf(Object obj)
Definition: Text.java:140
javolution.util.FastMap
Definition: FastMap.java:98
javolution.text.TextBuilder.append
final TextBuilder append(char c)
Definition: TextBuilder.java:202
javolution.text.Text.valueOf
static Text valueOf(char[] chars, int offset, int length)
Definition: Text.java:183
javolution.text.Text.copy
Text copy()
Definition: Text.java:1056
javolution.lang.MathLib
Definition: MathLib.java:20
javolution.text.Text.valueOf
static Text valueOf(float f)
Definition: Text.java:303
javolution.text.Text
Definition: Text.java:62
javolution.text.Text.newPrimitive
static Text newPrimitive(int length)
Definition: Text.java:1307
javolution.text.Text.compareTo
int compareTo(CharSequence csq)
Definition: Text.java:808
javolution.text.Text.TRUE
static final Text TRUE
Definition: Text.java:230
javolution.text.Text._data
final char[] _data
Definition: Text.java:90
javolution.text.TextBuilder
Definition: TextBuilder.java:29
javolution.text.Text.isBlank
boolean isBlank(int start, int length)
Definition: Text.java:1111
javolution.text.Text.lastIndexOfAny
int lastIndexOfAny(CharSet charSet, int start)
Definition: Text.java:1277
javolution.text.Text.valueOf
static Text valueOf(double d)
Definition: Text.java:315
javolution.xml.XMLSerializable
Definition: XMLSerializable.java:43
javolution.text.Text.valueOf
static Text valueOf(TextBuilder tb, int start, int end)
Definition: Text.java:205
javolution.text.Text.trimEnd
Text trimEnd()
Definition: Text.java:1141
javolution.text.Text.isBlank
boolean isBlank()
Definition: Text.java:1100
javolution.text.Text.indexOf
int indexOf(java.lang.CharSequence csq, int fromIndex)
Definition: Text.java:567
javolution.util.function.Equalities.LEXICAL
static final Equality< CharSequence > LEXICAL
Definition: Equalities.java:57
javolution.text.Text.Text
Text(boolean isPrimitive)
Definition: Text.java:112
javolution.text.Text.valueOf
static Text valueOf(boolean b)
Definition: Text.java:226
javolution.text.Text.valueOf
static Text valueOf(int i)
Definition: Text.java:253
javolution.text.Text.contentEqualsIgnoreCase
boolean contentEqualsIgnoreCase(java.lang.CharSequence csq)
Definition: Text.java:738
javolution.text.Text.lastIndexOf
int lastIndexOf(java.lang.CharSequence csq, int fromIndex)
Definition: Text.java:613
javolution.text.Text._head
Text _head
Definition: Text.java:100
javolution.util.FastMap.shared
FastMap< K, V > shared()
Definition: FastMap.java:164
javolution.text.TextBuilder.toText
final Text toText()
Definition: TextBuilder.java:769
javolution.text.Text._tail
Text _tail
Definition: Text.java:105
javolution.text.Text.indexOfAny
int indexOfAny(CharSet charSet)
Definition: Text.java:1220
javolution.text.Text.insert
Text insert(int index, Text txt)
Definition: Text.java:480
javolution.text.Text.subSequence
java.lang.CharSequence subSequence(int start, int end)
Definition: Text.java:540
javolution.text.Text.toText
Text toText()
Definition: Text.java:818
Comparable
javolution.text.Text.value
Text value()
Definition: Text.java:1329
javolution.text.Text.printStatistics
void printStatistics(PrintStream out)
Definition: Text.java:827
javolution.text.Text.lastIndexOf
int lastIndexOf(char c, int fromIndex)
Definition: Text.java:957
javolution.text.Text._count
int _count
Definition: Text.java:95
javolution.text.Text.hashCode
int hashCode()
Definition: Text.java:790
javolution.text.CharSet.contains
boolean contains(char c)
Definition: CharSet.java:135
javolution.text.Text.subtext
Text subtext(int start)
Definition: Text.java:466
javolution.text.Text.valueOf
static Text valueOf(String str)
Definition: Text.java:144
javolution.text.Text.padRight
Text padRight(int len)
Definition: Text.java:1191
javolution.lang
Definition: Configurable.java:9
javolution.util.function.Equalities
Definition: Equalities.java:20
javolution.text.Text.lastIndexOfAny
int lastIndexOfAny(CharSet charSet)
Definition: Text.java:1264
javolution.text.Text.startsWith
boolean startsWith(java.lang.CharSequence prefix, int index)
Definition: Text.java:669
javolution.text.Text.padLeft
Text padLeft(int len, char c)
Definition: Text.java:1176
javolution.text.Text.intern
Text intern()
Definition: Text.java:707
javolution.text.Text.indexOf
int indexOf(char c, int fromIndex)
Definition: Text.java:927
javolution.text.Text.valueOf
static Text valueOf(long l)
Definition: Text.java:278
javolution.text.Text.plus
Text plus(String str)
Definition: Text.java:368
javolution.text.Text.lastIndexOfAny
int lastIndexOfAny(CharSet charSet, int start, int length)
Definition: Text.java:1291
javolution.text.CharSet
Definition: CharSet.java:35
javolution.text.Text.valueOf
static Text valueOf(char c)
Definition: Text.java:240
javolution.text.Text.EMPTY
static final Text EMPTY
Definition: Text.java:85
javolution.util.function
Definition: Consumer.java:9
javolution.text.Text.BLOCK_SIZE
static final int BLOCK_SIZE
Definition: Text.java:69
javolution.text.Text.replace
Text replace(java.lang.CharSequence target, java.lang.CharSequence replacement)
Definition: Text.java:507
javolution.text.Text.endsWith
boolean endsWith(java.lang.CharSequence suffix)
Definition: Text.java:657
javolution.lang.Realtime
Definition: Realtime.java:59
javolution.text.Text.concat
Text concat(Text that)
Definition: Text.java:398
javolution.text.Text.replace
Text replace(CharSet charSet, java.lang.CharSequence replacement)
Definition: Text.java:524
javolution.text.Text.toUpperCase
Text toUpperCase()
Definition: Text.java:879
javolution.text.TextBuilder.getChars
final void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
Definition: TextBuilder.java:121
javolution.text.Text.valueOf
static Text valueOf(int i, int radix)
Definition: Text.java:266
javolution.text.Text.getChars
void getChars(int start, int end, char dest[], int destPos)
Definition: Text.java:1022
javolution.text.Text.padLeft
Text padLeft(int len)
Definition: Text.java:1160
javolution.text.Text.trim
Text trim()
Definition: Text.java:689
javolution.text.Text.valueOf
static Text valueOf(double d, int digits, boolean scientific, boolean showZero)
Definition: Text.java:335
javolution.text.Text.plus
Text plus(Object obj)
Definition: Text.java:357
javolution.text.Text.toLowerCase
Text toLowerCase()
Definition: Text.java:863
javolution.util.function.Equality.compare
int compare(T left, T right)
javolution.text.Text.valueOf
static Text valueOf(char[] chars)
Definition: Text.java:168
javolution.text.Text.indexOfAny
int indexOfAny(CharSet charSet, int start)
Definition: Text.java:1233
javolution.text.Text.getDepth
int getDepth()
Definition: Text.java:841
javolution.text.Text.indexOf
int indexOf(char c)
Definition: Text.java:913
javolution.text.Text.valueOf
static Text valueOf(long l, int radix)
Definition: Text.java:291
javolution.text.Text.serialVersionUID
static final long serialVersionUID
Definition: Text.java:64
javolution.text.Text.getNbrOfLeaves
int getNbrOfLeaves()
Definition: Text.java:852
javolution.text.Text.getNbrOfBranches
int getNbrOfBranches()
Definition: Text.java:847
javolution.text.Text.subtext
Text subtext(int start, int end)
Definition: Text.java:985
javolution.text.Text.lastIndexOf
int lastIndexOf(java.lang.CharSequence csq)
Definition: Text.java:599
javolution.text.Text.FALSE
static final Text FALSE
Definition: Text.java:232
javolution.text.Text.trimStart
Text trimStart()
Definition: Text.java:1125
javolution.xml
Definition: DefaultXMLFormat.java:9
javolution.text.Text.valueOf
static Text valueOf(char c, int length)
Definition: Text.java:1078
javolution.text.Text.padRight
Text padRight(int len, char c)
Definition: Text.java:1207
javolution.text.Text.startsWith
boolean startsWith(java.lang.CharSequence prefix)
Definition: Text.java:645
javolution.text.Text.INTERN
static final FastMap< Text, Text > INTERN
Definition: Text.java:79
javolution.text.Text.indexOf
int indexOf(java.lang.CharSequence csq)
Definition: Text.java:552
javolution.lang.ValueType
Definition: ValueType.java:63
javolution.text.Text.valueOf
static Text valueOf(String str, int start, int end)
Definition: Text.java:148
javolution.util
Definition: FastBitSet.java:9
javolution.text.Text.indexOfAny
int indexOfAny(CharSet charSet, int start, int length)
Definition: Text.java:1247
javolution.lang.MathLib.min
static int min(int x, int y)
Definition: MathLib.java:1010
javolution.text.Text.append
Text append(String str)
Definition: Text.java:374