/** * Adds the specified character to this set if it is not already * present. If this set already contains the specified character, * the call leaves this set unchanged. * @stable ICU 2.0 */ public final UnicodeSet add(int c) { checkFrozen(); return add_unchecked(c); }
/** * Adds all characters in range (uses preferred naming convention). * @param start The index of where to start on adding all characters. * @param end The index of where to end on adding all characters. * @return a reference to this object * @stable ICU 4.4 */ public UnicodeSet addAll(int start, int end) { checkFrozen(); return add_unchecked(start, end); }
/** * Adds the specified range to this set if it is not already * present. If this set already contains the specified range, * the call leaves this set unchanged. If <code>end > start</code> * then an empty range is added, leaving the set unchanged. * * @param start first character, inclusive, of range to be added * to this set. * @param end last character, inclusive, of range to be added * to this set. * @stable ICU 2.0 */ public UnicodeSet add(int start, int end) { checkFrozen(); return add_unchecked(start, end); }
/** * Adds the specified multicharacter to this set if it is not already * present. If this set already contains the multicharacter, * the call leaves this set unchanged. * Thus "ch" => {"ch"} * <br><b>Warning: you cannot add an empty string ("") to a UnicodeSet.</b> * @param s the source string * @return this object, for chaining * @stable ICU 2.0 */ public final UnicodeSet add(CharSequence s) { checkFrozen(); int cp = getSingleCP(s); if (cp < 0) { strings.add(s.toString()); pat = null; } else { add_unchecked(cp, cp); } return this; }
/** * Adds each of the characters in this string to the set. Thus "ch" => {"c", "h"} * If this set already any particular character, it has no effect on that character. * @param s the source string * @return this object, for chaining * @stable ICU 2.0 */ public final UnicodeSet addAll(CharSequence s) { checkFrozen(); int cp; for (int i = 0; i < s.length(); i += UTF16.getCharCount(cp)) { cp = UTF16.charAt(s, i); add_unchecked(cp, cp); } return this; }
add_unchecked(startHasProperty, ch-1); startHasProperty = -1; add_unchecked(startHasProperty, 0x10FFFF);
add_unchecked(lastChar, lastChar); _appendToPat(patBuf, lastChar, false); lastItem = LAST0_START; case ']': if (lastItem == LAST1_RANGE) { add_unchecked(lastChar, lastChar); _appendToPat(patBuf, lastChar, false); add_unchecked(op, op); patBuf.append(op); } else if (op == '&') { add_unchecked(c, c); c = chars.next(opts); literal = chars.isEscaped(); add_unchecked(lastChar, lastChar); _appendToPat(patBuf, lastChar, false); add_unchecked(lastChar, lastChar); _appendToPat(patBuf, lastChar, false); add_unchecked(UnicodeMatcher.ETHER); usePat = true; patBuf.append(SymbolTable.SYMBOL_REF).append(']'); add_unchecked(lastChar, c); _appendToPat(patBuf, lastChar, false);
add_unchecked(ch); return this;