Exemplo n.º 1
0
 public void RegisterOverlay(Widget widget)
 {
     if (widget != null && !Overlays.Contains(widget))
     {
         Overlays.Add(widget);
     }
 }
Exemplo n.º 2
0
        public IEnumerable <KSNeuronLib.Neuron> GetSortedExcitedNeurons()
        {
            if (m_FiredNeuronsCount == 0)
            {
                return(null);
            }

            BinarySortedList <Neuron> SortedExcitedNeurons = new BinarySortedList <Neuron>(new KSNeuronLib.NeuronComparerByExcitementDesc());

            //BinarySortedList<Neuron> SortedExcitedNeurons = new BinarySortedList<Neuron>(new KSNeuronLib.NeuronComparerByEnergyAndExcitementDesc());
            //SortedSet<KSNeuronLib.Neuron> SortedExcitedNeurons = new SortedSet<KSNeuronLib.Neuron>(new KSNeuronLib.NeuronComparerByEnergyAndExcitementDesc());
            //List<KSNeuronLib.Neuron> SortedExcitedNeurons = new List<Neuron>();

            //foreach (KSNeuronLib.Neuron n in FiredNeurons)
            for (int i = 0; i < m_FiredNeuronsCount; i++)
            {
                Neuron n = m_FiredNeurons[i];
                if (n == null)  // How can this ever happen ?? it does !
                {
                    continue;
                }

                if (!n.IsEmptyNeuron && n.NeuronType != KSNeuronLib.Neuron.NeuronTypes.Interneuron &&
                    n.FireState != KSNeuronLib.Neuron.FireStates.autofire &&
                    n.Excitement > 0.01f)
                {
                    SortedExcitedNeurons.Add(n);
                }
            }

            //SortedExcitedNeurons.Sort(new KSNeuronLib.NeuronComparerByExcitementDesc());

            return(SortedExcitedNeurons);
        }
        public static BinarySortedList <int> RandomBinarySortedList(int count)
        {
            IEnumerable <int> enu = NumberProducer(count);

            BinarySortedList <int> result = new BinarySortedList <int> ();

            foreach (int i in enu)
            {
                result.Add(i);
            }
            //result.AddUnsorted (i);

            //result.NaturalMergeSort ();

            return(result);
        }