Ejemplo n.º 1
0
 public NodeContainer(int keyLength, Func <ChildContainer <T> > factory)
 {
     _keylength = keyLength;
     _comparer  = new NodeComparer(_keylength);
     _factory   = factory;
     _children  = new List <Tuple <string[], Node <T> > >(5);
 }
Ejemplo n.º 2
0
        public Node <T> FindFirstNodeThatMatches(string[] route, int compareLength)
        {
            NodeComparer compare = new NodeComparer(compareLength);

            foreach (var kv in _children)
            {
                if (compare.Equals(kv.Key, route))
                {
                    return(kv.Value);
                }
            }
            return(null);
        }
Ejemplo n.º 3
0
        public Node <T> FindFirstNodeThatMatches(string[] route, int compareLength)
        {
            NodeComparer compare;

            if (compareLength != _keylength)
            {
                compare = new NodeComparer(compareLength);
            }
            else
            {
                compare = _comparer;
            }
            foreach (var child in _children)
            {
                if (compare.Equals(child.Item1, route))
                {
                    return(child.Item2);
                }
            }
            return(null);
        }