Esempio n. 1
0
 protected CharMatchBase(CharMatchBase previous)
 {
     if (previous != null)
     {
         previous.Next = this;
     }
 }
Esempio n. 2
0
        public static bool Match(string queue, string key)
        {
            var queueParts = queue.Split('.');

            CharMatchBase previous = null;
            IMatchChar    first    = null;

            for (int i = 0; i < queueParts.Length; i++)
            {
                switch (queueParts[i])
                {
                case "*":
                    previous = new StarMatch(previous);
                    break;

                case "#":
                    previous = new HashMatch(previous);
                    break;

                default:
                    previous = new CharMatch(previous, queueParts[i]);
                    break;
                }
                if (i == 0)
                {
                    first = previous;
                }
            }

            var keyParts = new LinkedList <string>(key.Split('.'));

            if (first == null)
            {
                return(false);
            }

            first.Consume(keyParts);

            return(first.MatchValues.All(x => x));
        }
Esempio n. 3
0
 public StarMatch(CharMatchBase previous)
     : base(previous)
 {
 }
Esempio n. 4
0
 public HashMatch(CharMatchBase previous)
     : base(previous)
 {
 }
Esempio n. 5
0
 public CharMatch(CharMatchBase previous, string keyPart)
     : base(previous)
 {
     this.keyPart = keyPart;
 }