/// <summary> /// 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. /// </summary> /// <param name="set">This set.</param> /// <param name="s">The source string.</param> /// <returns>this object, for chaining.</returns> /// <draft>ICU4N 60.1</draft> /// <provisional>This API might change or be removed in a future release.</provisional> public static UnicodeSet AddAll(this UnicodeSet set, string s) { if (set == null) { throw new ArgumentNullException(nameof(set)); } return(set.AddAll(s)); }
/// <summary> /// Complements in this set all elements contained in the specified /// set. Any character in the other set will be removed if it is /// in this set, or will be added if it is not in this set. /// </summary> /// <param name="c">Set that defines which elements will be complemented from /// this set.</param> /// <draft>ICU4N 60.1</draft> /// <provisional>This API might change or be removed in a future release.</provisional> public virtual UnicodeSet SymmetricExceptWith(UnicodeSet c) { if (c == null) { throw new ArgumentNullException(nameof(c)); } return(ComplementAll(c)); }
/// <seealso cref="UnicodeSet.AddAll(UnicodeSet)"/> /// <draft>ICU4N 60.1</draft> /// <provisional>This API might change or be removed in a future release.</provisional> // See ticket #11395, this is safe. public static UnicodeSet AddAll(this UnicodeSet set, params string[] collection) { if (set == null) { throw new ArgumentNullException(nameof(set)); } return(set.AddAll(collection)); }
/// <summary> /// Returns true if this set contains all the characters and strings /// of the given set. /// </summary> /// <param name="b">Set to be checked for containment.</param> /// <returns>true if the test condition is met.</returns> /// <draft>ICU4N 60.1</draft> /// <provisional>This API might change or be removed in a future release.</provisional> public virtual bool IsSupersetOf(UnicodeSet b) { if (b == null) { throw new ArgumentNullException(nameof(b)); } return(ContainsAll(b)); }
/// <summary> /// Complement EACH of the characters in this string. Note: "ch" == {"c", "h"} /// If this set already any particular character, it has no effect on that character. /// </summary> /// <param name="set">This set.</param> /// <param name="s">The source string.</param> /// <returns>This object, for chaining.</returns> /// <draft>ICU4N 60.1</draft> /// <provisional>This API might change or be removed in a future release.</provisional> public static UnicodeSet ComplementAll(this UnicodeSet set, StringBuilder s) { if (set == null) { throw new ArgumentNullException(nameof(set)); } return(set.ComplementAll(s)); }
/// <seealso cref="UnicodeSet.RetainAll(UnicodeSet)"/> /// <draft>ICU4N 60.1</draft> /// <provisional>This API might change or be removed in a future release.</provisional> public static UnicodeSet RetainAll <T>(this UnicodeSet set, IEnumerable <T> collection) where T : ICharSequence { if (set == null) { throw new ArgumentNullException(nameof(set)); } return(set.RetainAll(collection)); }
/// <summary> /// Retains EACH of the characters in this string. Note: "ch" == {"c", "h"} /// If this set already any particular character, it has no effect on that character. /// </summary> /// <param name="set">This set.</param> /// <param name="s">The source string.</param> /// <returns>This object, for chaining.</returns> /// <draft>ICU4N 60.1</draft> /// <provisional>This API might change or be removed in a future release.</provisional> public static UnicodeSet RetainAll(this UnicodeSet set, ICharSequence s) { if (set == null) { throw new ArgumentNullException(nameof(set)); } return(set.RetainAll(s)); }
/// <summary> /// Complement the specified string in this set. /// The set will not contain the specified string once the call /// returns. /// <para/> /// <b>Warning: you cannot add an empty string ("") to a UnicodeSet.</b> /// </summary> /// <param name="set">This set.</param> /// <param name="s">The string to complement.</param> /// <returns>This object, for chaining.</returns> /// <draft>ICU4N 60.1</draft> /// <provisional>This API might change or be removed in a future release.</provisional> public static UnicodeSet Complement(this UnicodeSet set, char[] s) { if (set == null) { throw new ArgumentNullException(nameof(set)); } return(set.Complement(s)); }
/// <seealso cref="UnicodeSet.RetainAll(UnicodeSet)"/> /// <draft>ICU4N 60.1</draft> /// <provisional>This API might change or be removed in a future release.</provisional> public static UnicodeSet RetainAll(this UnicodeSet set, IEnumerable <char[]> collection) { if (set == null) { throw new ArgumentNullException(nameof(set)); } return(set.RetainAll(collection)); }
/// <seealso cref="UnicodeSet.ContainsSome(UnicodeSet)"/> /// <draft>ICU4N 60.1</draft> /// <provisional>This API might change or be removed in a future release.</provisional> public static bool ContainsSome(this UnicodeSet set, IEnumerable <char[]> collection) { if (set == null) { throw new ArgumentNullException(nameof(set)); } return(set.ContainsSome(collection)); }
/// <seealso cref="UnicodeSet.RemoveAll(UnicodeSet)"/> /// <draft>ICU4N 60.1</draft> /// <provisional>This API might change or be removed in a future release.</provisional> public static UnicodeSet RemoveAll(this UnicodeSet set, IEnumerable <StringBuilder> collection) { if (set == null) { throw new ArgumentNullException(nameof(set)); } return(set.RemoveAll(collection)); }
/// <summary> /// Returns true if this set contains one or more of the characters /// of the given string. /// </summary> /// <param name="set">This set.</param> /// <param name="s">String containing characters to be checked for containment.</param> /// <returns>true if the condition is met.</returns> /// <draft>ICU4N 60.1</draft> /// <provisional>This API might change or be removed in a future release.</provisional> public static bool ContainsSome(this UnicodeSet set, StringBuilder s) { if (set == null) { throw new ArgumentNullException(nameof(set)); } return(set.ContainsSome(s)); }
/// <summary> /// Returns true if this set contains one or more of the characters /// of the given string. /// </summary> /// <param name="set">This set.</param> /// <param name="s">String containing characters to be checked for containment.</param> /// <returns>true if the condition is met.</returns> /// <draft>ICU4N 60.1</draft> /// <provisional>This API might change or be removed in a future release.</provisional> public static bool ContainsSome(this UnicodeSet set, ICharSequence s) { if (set == null) { throw new ArgumentNullException(nameof(set)); } return(set.ContainsSome(s)); }
/// <summary> /// Adds all of the elements in the specified set to this set if /// they're not already present. This operation effectively /// modifies this set so that its value is the <i>union</i> of the two /// sets. The behavior of this operation is unspecified if the specified /// collection is modified while the operation is in progress. /// </summary> /// <param name="c">Set whose elements are to be added to this set.</param> /// <draft>ICU4N 60.1</draft> /// <provisional>This API might change or be removed in a future release.</provisional> public virtual UnicodeSet UnionWith(UnicodeSet c) { if (c == null) { throw new ArgumentNullException(nameof(c)); } return(AddAll(c)); }
/// <summary> /// Retains only the elements in this set that are contained in the /// specified set. In other words, removes from this set all of /// its elements that are not contained in the specified set. This /// operation effectively modifies this set so that its value is /// the <i>intersection</i> of the two sets. /// </summary> /// <param name="c">Set that defines which elements this set will retain.</param> /// <stable>ICU 2.0</stable> public virtual UnicodeSet IntersectWith(UnicodeSet c) { if (c == null) { throw new ArgumentNullException(nameof(c)); } return(RetainAll(c)); }
/// <summary> /// Returns true if this set contains one or more of the characters /// and strings of the given set. /// </summary> /// <param name="s">Set to be checked for containment.</param> /// <returns>True if the condition is met.</returns> /// <draft>ICU4N 60.1</draft> /// <provisional>This API might change or be removed in a future release.</provisional> public bool Overlaps(UnicodeSet s) { if (s == null) { throw new ArgumentNullException(nameof(s)); } return(ContainsSome(s)); }
/// <summary> /// Complement the specified string in this set. /// The set will not contain the specified string once the call /// returns. /// <para/> /// <b>Warning: you cannot add an empty string ("") to a UnicodeSet.</b> /// </summary> /// <param name="set">This set.</param> /// <param name="s">The string to complement.</param> /// <returns>This object, for chaining.</returns> /// <draft>ICU4N 60.1</draft> /// <provisional>This API might change or be removed in a future release.</provisional> internal static UnicodeSet Complement(this UnicodeSet set, ICharSequence s) { if (set == null) { throw new ArgumentNullException(nameof(set)); } return(set.Complement(s)); }
/// <summary> /// Retain the specified string in this set if it is present. /// Upon return this set will be empty if it did not contain <paramref name="cs"/>, or /// will only contain <paramref name="cs"/> if it did contain <paramref name="cs"/>. /// </summary> /// <param name="set">This set.</param> /// <param name="cs">The string to be retained.</param> /// <returns>This object, for chaining.</returns> /// <draft>ICU4N 60.1</draft> /// <provisional>This API might change or be removed in a future release.</provisional> public static UnicodeSet Retain(this UnicodeSet set, char[] cs) { if (set == null) { throw new ArgumentNullException(nameof(set)); } return(set.Retain(cs)); }
/// <summary> /// Union the set of all characters that may output by this object /// into the given set. /// </summary> /// <param name="toUnionTo">The set into which to union the output characters.</param> public virtual void AddReplacementSetTo(UnicodeSet toUnionTo) { // The output of this replacer varies; it is the source text between // matchStart and matchLimit. Since this varies depending on the // input text, we can't compute it here. We can either do nothing // or we can add ALL characters to the set. It's probably more useful // to do nothing. }
public CompoundRBTEntry(string theID, IList <string> theIDBlockVector, IList <Data> theDataVector, UnicodeSet theCompoundFilter) { id = theID; idBlockVector = theIDBlockVector; dataVector = theDataVector; compoundFilter = theCompoundFilter; }
/// <summary> /// Determines whether a <see cref="UnicodeSet"/> object is a subset of the specified <see cref="UnicodeSet"/>. /// </summary> /// <param name="other">The collection to compare to the current <see cref="UnicodeSet"/> object.</param> /// <returns>true if the <see cref="UnicodeSet"/> object is a subset of other; otherwise, false.</returns> /// <draft>ICU4N 60.1</draft> /// <provisional>This API might change or be removed in a future release.</provisional> public virtual bool IsSubsetOf(UnicodeSet other) { if (other == null) { throw new ArgumentNullException(nameof(other)); } return(IsSubsetOfInternal(other)); }
/// <summary> /// Temporary hack for registry problem. Needs to be replaced by better architecture. /// </summary> public virtual Transliterator SafeClone() { UnicodeFilter filter = Filter; if (filter != null && filter is UnicodeSet) { filter = new UnicodeSet((UnicodeSet)filter); } return(new AnyTransliterator(ID, filter, target, targetScript, widthFix, cache)); }
/// <summary> /// Temporary hack for registry problem. Needs to be replaced by better architecture. /// </summary> public virtual Transliterator SafeClone() { UnicodeFilter filter = Filter; if (filter != null && filter is UnicodeSet) { filter = new UnicodeSet((UnicodeSet)filter); } return(new CompoundTransliterator(ID, filter, trans, numAnonymousRBTs)); }
public Transliterator SafeClone() { UnicodeFilter filter = Filter; if (filter != null && filter is UnicodeSet) { filter = new UnicodeSet((UnicodeSet)filter); } return(new RuleBasedTransliterator(ID, data, filter)); }
/// <seealso cref="Transliterator.AddSourceTargetSet(UnicodeSet, UnicodeSet, UnicodeSet)"/> public override void AddSourceTargetSet(UnicodeSet inputFilter, UnicodeSet sourceSet, UnicodeSet targetSet) { UnicodeSet myFilter = GetFilterAsUnicodeSet(inputFilter); // Doesn't actually modify the source characters, so leave them alone. // add the characters inserted if (myFilter.Count != 0) { targetSet.AddAll(insertion); } }
// // RBBISymbolTable::lookupMatcher This function from the abstract symbol table // interface maps a single stand-in character to a // pointer to a Unicode Set. The Unicode Set code uses this // mechanism to get all references to the same $variable // name to refer to a single common Unicode Set instance. // // This implementation cheats a little, and does not maintain a map of stand-in chars // to sets. Instead, it takes advantage of the fact that the UnicodeSet // constructor will always call this function right after calling lookup(), // and we just need to remember what set to return between these two calls. public virtual IUnicodeMatcher LookupMatcher(int ch) { UnicodeSet retVal = null; if (ch == 0xffff) { retVal = fCachedSetLookup; fCachedSetLookup = null; } return(retVal); }
public CompoundRBTEntry(string theID, IList <string> theIDBlockVector, #pragma warning disable 612, 618 IList <Data> theDataVector, #pragma warning restore 612, 618 UnicodeSet theCompoundFilter) { id = theID; idBlockVector = theIDBlockVector; dataVector = theDataVector; compoundFilter = theCompoundFilter; }
private bool IsSubsetOfInternal(UnicodeSet other) { foreach (var item in this) { if (!other.Contains(item)) { return(false); } } return(true); }
/// <seealso cref="Transliterator.AddSourceTargetSet(UnicodeSet, UnicodeSet, UnicodeSet)"/> public override void AddSourceTargetSet(UnicodeSet inputFilter, UnicodeSet sourceSet, UnicodeSet targetSet) { UnicodeSet myFilter = GetFilterAsUnicodeSet(inputFilter); // Assume that it can modify any character to any other character sourceSet.AddAll(myFilter); if (myFilter.Count != 0) { targetSet.AddAll(0, 0x10FFFF); } }
// TODO Handle the case where we have :: [a] ; a > |b ; b > c ; // TODO Merge into r.addSourceTargetSet, to avoid duplicate testing internal virtual void AddSourceTargetSet(UnicodeSet filter, UnicodeSet sourceSet, UnicodeSet targetSet) { UnicodeSet currentFilter = new UnicodeSet(filter); UnicodeSet revisiting = new UnicodeSet(); int count = ruleVector.Count; for (int i = 0; i < count; ++i) { TransliterationRule r = ruleVector[i]; r.AddSourceTargetSet(currentFilter, sourceSet, targetSet, revisiting.Clear()); currentFilter.AddAll(revisiting); } }