예제 #1
0
            public void AddEntry(Entry entry)
            {
                EntrySet entrySet;

                if (m_EntrySets.ContainsKey(entry.Distance))
                {
                    entrySet = m_EntrySets[entry.Distance];
                }
                else
                {
                    entrySet = new EntrySet(entry.Distance);
                    m_EntrySets.Add(entry.Distance, entrySet);
                }

                entrySet.AddEntry(entry);
            }
예제 #2
0
        public bool SearchOctant(
            Map map,
            Compass compass,
            int start,
            SearchDirection direction,
            Tour tour
            )
        {
            SearchSet oc   = m_Octants[(int)compass];
            int       incr = direction == SearchDirection.Outwards ? 1 : -1;

            for (int i = start;; i += incr)
            {
                if (i < 0 || i > m_Radius)
                {
                    return(false);
                }

                EntrySet entrySet = oc.GetEntrySet(i);

                if (entrySet == null)
                {
                    continue;
                }

                List <Entry> entries = entrySet.Entries;

                foreach (OctantEntry entry in entries)
                {
                    if (tour(map, entry.X, entry.Y))
                    {
                        return(true);
                    }
                }

                return(false);
            }
        }
예제 #3
0
        public void AddEntry( Entry entry )
        {
            EntrySet entrySet;

            if( m_EntrySets.ContainsKey( entry.Distance ) )
            {
                entrySet = m_EntrySets[ entry.Distance ];
            }
            else
            {
                entrySet = new EntrySet( entry.Distance );
                m_EntrySets.Add( entry.Distance, entrySet );
            }

            entrySet.AddEntry( entry );
        }