예제 #1
0
        public void registerEvent(String eventName)
        {
            String[] tokens            = eventName.Split('.');
            EventListenerTreeNode node = myRootEventListener;

            for (int i = 0; i < tokens.Length; i++)
            {
                if (tokens[i] == "*")
                {
                    continue;
                }

                String name = tokens[0];
                for (int j = 1; j <= i; j++)
                {
                    name = name + "." + tokens[j];
                }

                //is this the last token in the event name, don't add a wildcard
                if (i == tokens.Length - 1)
                {
                    node = node.addChild(name);
                }
                else
                {
                    node = node.addChild(name + ".*");
                }
            }
        }
예제 #2
0
        public EventListenerTreeNode addChild(String s)
        {
            EventListenerTreeNode node = null;
            EventId en = new EventId(s);

            int val = en.myIds[myDepth];

            if (myChildren.TryGetValue(val, out node))
            {
                node = myChildren[val];
            }
            else
            {
                node            = new EventListenerTreeNode(s, myDepth + 1);
                myChildren[val] = node;
            }

            return(node);
        }