Beispiel #1
0
        public bool AddKeys(string value)
        {
            if (value == null)
            {
                return(false);
            }

            ReadOnlySpan <char> span = value.AsSpan();
            int commaIndex           = span.IndexOf(',');

            if (commaIndex < 0)
            {
                _first  = GetKey(span);
                _getKey = Generators[(uint)_first];
                return(_first != GroupKeys.None);
            }

            _first = GetKey(span.Slice(0, commaIndex));
            if (_first == GroupKeys.None)
            {
                return(false);
            }


            _second = GetKey(span.Slice(commaIndex + 1));
            _getKey = Generators[(uint)(_first | _second)];
            return(_second != GroupKeys.None);
        }
Beispiel #2
0
 public override void Reset()
 {
     _first  = GroupKeys.None;
     _second = GroupKeys.None;
     _grouped.Clear();
     _results.Clear();
     base.Reset();
 }
Beispiel #3
0
 public bool Equals(GroupKeys other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(string.Equals(Key1, other.Key1) &&
            string.Equals(Key2, other.Key2));
 }
Beispiel #4
0
        public string this[GroupKeys key]
        {
            get {
                switch (key)
                {
                case GroupKeys.Sex:
                    return(SexStatus.ToNullableSexString());

                case GroupKeys.Status:
                    return(SexStatus.ToNullableStatusString());

                case GroupKeys.Interests:
                    return(StringIndexer.Interests[InterestIndex]);

                case GroupKeys.City:
                    return(StringIndexer.Cities[CityIndex]);

                case GroupKeys.Country:
                    return(StringIndexer.Countries[CountryIndex]);
                }
                throw new InvalidOperationException("This should never happen");
            }
        }
Beispiel #5
0
 private static void SerializeGroupKey(ref ParseContext stream, GroupKeys groupKey, in GroupKey group)