/** * Constructs a copy of an existing set. * @stable ICU 2.0 */ public UnicodeSet(UnicodeSet other) { set(other); }
/** * Constructor: Create a Spoof Checker Builder, and set the configuration from an existing SpoofChecker. * * @param src * The existing checker. * @stable ICU 4.6 */ public Builder(SpoofChecker src) { fChecks = src.fChecks; fSpoofData = src.fSpoofData; // For the data, we will either use the source data // as-is, or drop the builder's reference to it // and generate new data, depending on what our // caller does with the builder. fAllowedCharsSet.set(src.fAllowedCharsSet); fAllowedLocales.addAll(src.fAllowedLocales); fRestrictionLevel = src.fRestrictionLevel; }
/** * Limit the acceptable characters to those specified by a Unicode Set. Any previously specified character limit * is is replaced by the new settings. This includes limits on characters that were set with the * setAllowedLocales() function. Note that the RESTRICTED set is useful. * * The {@link #CHAR_LIMIT} test is automatically enabled for this SpoofChecker by this function. * * @param chars * A Unicode Set containing the list of characters that are permitted. The incoming set is cloned by * this function, so there are no restrictions on modifying or deleting the UnicodeSet after calling * this function. Note that this clears the allowedLocales set. * @return self * @stable ICU 4.6 */ public Builder setAllowedChars(UnicodeSet chars) { fAllowedCharsSet.set(chars); fAllowedLocales.clear(); fChecks |= CHAR_LIMIT; return this; }
private void enumCnERange(int start, int end, int ce32, ContractionsAndExpansions cne) { if (cne.checkTailored == 0) { // There is no tailoring. // No need to collect nor check the tailored set. } else if (cne.checkTailored < 0) { // Collect the set of code points with mappings in the tailoring data. if (ce32 == Collation.FALLBACK_CE32) { return; // fallback to base, not tailored } else { cne.tailored.add(start, end); } // checkTailored > 0: Exclude tailored ranges from the base data enumeration. } else if (start == end) { if (cne.tailored.contains(start)) { return; } } else if (cne.tailored.containsSome(start, end)) { if (cne.ranges == null) { cne.ranges = new UnicodeSet(); } cne.ranges.set(start, end).removeAll(cne.tailored); int count = cne.ranges.getRangeCount(); for (int i = 0; i < count; ++i) { cne.handleCE32(cne.ranges.getRangeStart(i), cne.ranges.getRangeEnd(i), ce32); } } cne.handleCE32(start, end, ce32); }
set(nested); mode = MODE2_OUTBRACKET; break;