Пример #1
0
        /**
         * Search for a mapping, fuzzily
         * @param result the query
         * @return the corresponding state or NULL otherwise
         */
        public DA_State find(SafraTreeTemplate result)
        {
            //map_type::const_iterator it;

            AbstractedKeyType search_key = new AbstractedKeyType(result.getState());

            //it = _map.find(search_key);

            if (_map.ContainsKey(search_key))
            {
                ValueList list = _map[search_key];

                int count = 0;
                while (list != null)
                {
                    // check to see if we are compatible

                    if (SafraTreeCandidateMatcher.isMatch(result, list._key))
                    {
                        //std::cerr << "Found: "<< count << std::endl;
                        return(list._state);
                    }

                    //	std::cerr << "Tree: "<< *list->_tree;

                    list = list._next;
                    count++;
                }
                //      std::cerr << "Not found: "<< count << std::endl;
            }

            // not found
            return(null);
        }
Пример #2
0
        public int hashCode()
        {
            StdHashFunction hash = new StdHashFunction();

            SafraTreeCandidateMatcher.abstract_hash_code(hash, _key);
            return(hash.value());
        }
Пример #3
0
        public static bool operator ==(AbstractedKeyType one, AbstractedKeyType other)
        {
            bool?val = Ultility.NullCheck(one, other);

            if (val != null)
            {
                return(val.Value);
            }

            return(SafraTreeCandidateMatcher.abstract_equal_to(one._key, other._key));
        }
Пример #4
0
 public static bool operator <(AbstractedKeyType one, AbstractedKeyType other)
 {
     return(SafraTreeCandidateMatcher.abstract_less_than(one._key, other._key));
 }