Beispiel #1
0
        /// <seealso cref="Transliterator.AddSourceTargetSet(UnicodeSet, UnicodeSet, UnicodeSet)"/>
        public override void AddSourceTargetSet(UnicodeSet inputFilter, UnicodeSet sourceSet, UnicodeSet targetSet)
        {
            UnicodeSet myFilter = GetFilterAsUnicodeSet(inputFilter);

            if (!myFilter.ContainsAll(UnicodeNameTransliterator.OPEN_DELIM) || !myFilter.Contains(CLOSE_DELIM))
            {
                return; // we have to contain both prefix and suffix
            }
            UnicodeSet items = new UnicodeSet()
                               .AddAll('0', '9')
                               .AddAll('A', 'F')
                               .AddAll('a', 'z')  // for controls
                               .Add('<').Add('>') // for controls
                               .Add('(').Add(')') // for controls
                               .Add('-')
                               .Add(' ')
                               .AddAll(UnicodeNameTransliterator.OPEN_DELIM)
                               .Add(CLOSE_DELIM);

            items.RetainAll(myFilter);
            if (items.Count > 0)
            {
                sourceSet.AddAll(items);
                // could produce any character
                targetSet.AddAll(0, 0x10FFFF);
            }
        }
Beispiel #2
0
        public virtual void AddSourceTargetSet(Transliterator transliterator, UnicodeSet inputFilter, UnicodeSet sourceSet,
                                               UnicodeSet targetSet)
        {
#pragma warning disable 612, 618
            UnicodeSet myFilter = transliterator.GetFilterAsUnicodeSet(inputFilter);
#pragma warning restore 612, 618
            UnicodeSet affectedCharacters = new UnicodeSet(sourceCache).RetainAll(myFilter);
            sourceSet.AddAll(affectedCharacters);
            foreach (string s in affectedCharacters)
            {
                targetSet.AddAll(transform.Transform(s));
            }
            foreach (string s in sourceStrings)
            {
                if (myFilter.ContainsAll(s))
                {
                    string t = transform.Transform(s);
                    if (!s.Equals(t))
                    {
                        targetSet.AddAll(t);
                        sourceSet.AddAll(s);
                    }
                }
            }
        }
Beispiel #3
0
 /// <seealso cref="UnicodeSet.ContainsAll(UnicodeSet)"/>
 /// <draft>ICU4N 60.1</draft>
 /// <provisional>This API might change or be removed in a future release.</provisional>
 public static bool ContainsAll <T>(this UnicodeSet set, IEnumerable <T> collection) where T : ICharSequence
 {
     if (set == null)
     {
         throw new ArgumentNullException(nameof(set));
     }
     return(set.ContainsAll(collection));
 }
Beispiel #4
0
 /// <seealso cref="UnicodeSet.ContainsAll(UnicodeSet)"/>
 /// <draft>ICU4N 60.1</draft>
 /// <provisional>This API might change or be removed in a future release.</provisional>
 public static bool ContainsAll(this UnicodeSet set, IEnumerable <char[]> collection)
 {
     if (set == null)
     {
         throw new ArgumentNullException(nameof(set));
     }
     return(set.ContainsAll(collection));
 }