Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        public GraphBase(IController parent, IDataProviderOwner owner)
            : base(parent)
        {
            Owner = owner;

            Key                 = System.Guid.NewGuid().ToString();
            GraphType           = GraphTypes.gtFunction;
            GraphSubType        = GraphSubTypes.gstLinear;
            GraphDescription    = "unknown";
            GraphFunctionString = "";

            XAxisDataType = AxisDataTypes.axNumeric;
            StringFormatX = "";
            StringFormatY = "";

            Visible     = true;
            HasResult   = true;
            CanEvaluate = true;

            Points = new BinarySortedList <GraphPoint>();
            ListID = 0;

            ColumnManager    = this.AddSubController(new ColumnManager(this, Owner));
            RowManager       = this.AddSubController(new RowManager(this, Owner));
            SelectionManager = this.AddSubController(new SelectionManager(this, Owner));

            InitializeColumns();
            InitializeRows();

            MinX = -10.0;
            MaxX = 10.0;
            MinY = -10.0;
            MaxY = 10.0;
        }
Ejemplo n.º 3
0
 public RowManager(IController parent, IRowManagerOwner owner)
     : base(parent)
 {
     Owner = owner;
     if (Owner != null)
     {
         Scrollbar = Owner.VScrollBar;
     }
     m_Observable = new Observable <EventMessage> ();
     RowOffsets   = new BinarySortedList <float> ();
 }
Ejemplo n.º 4
0
        void ResetCachedData()
        {
            Concurrency.LockFreeUpdate(ref m_SortedVisibleColumns, Columns.SortedVisibleColumns.ToArray());

            var   lst    = new BinarySortedList <float> ();
            float offset = 0;

            Columns.Where(col => col.Visible).ForEach(col => {
                lst.AddLast(offset);
                offset += col.Width;
            });
            Concurrency.LockFreeUpdate(ref m_ColumnOffsets, lst);
        }
        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);
        }
Ejemplo n.º 6
0
        public SideMenuBar(string name, IGuiMenu menu)
            : base(name, Docking.Fill, new EmptyWidgetStyle())
            //: base(name, menu)
        {
            IsMenu        = true;
            Menu          = menu;
            MenuDirtyFlag = true;

            this.SetIconFontByTag(CommonFontTags.SmallIcons);
            this.SetFontByTag(CommonFontTags.Menu);
            //ZIndex = 3000;

            Styles.SetStyle(new SubMenuDisabledItemStyle(), WidgetStates.Disabled);
            Styles.SetStyle(new SubMenuSelectedItemStyle(), WidgetStates.Selected);
            Styles.SetStyle(new SubMenuActiveItemStyle(), WidgetStates.Active);

            ZIndex   = 0;
            CanFocus = false;
            //TabIndex = -1;

            LastExpandedItems = new BinarySortedList <IGuiMenuItem> ();
        }
Ejemplo n.º 7
0
        public RootContainer(IGUIContext ctx, string name)
            : base(name, Docking.Fill, new EmptyWidgetStyle())
        {
            CTX      = ctx;
            Overlays = new BinarySortedList <Widget> ();
            if (ctx != null)
            {
                this.SetSize(ctx.Width, ctx.Height);
            }

            m_Tooltip         = new TooltipWidget("root");
            m_Tooltip.MaxSize = new SizeF(320, 600);
            m_Tooltip.ZIndex  = this.ZIndex + 10000;
            AddChild(m_Tooltip);
            CanFocus           = false;
            TabIndex           = -1;
            TooltipDelayAction = new DelayedAction(500, TooltipAction);
            HeartbeatTimer     = new TaskTimer(500, Heartbeat);
            HeartbeatTimer.Start();
            HeartbeatSubscriptions = new HashSet <Widget> ();
            Tooltip  = null;
            Messages = new MessageQueue <EventMessage> (true);
        }
 public WidgetTableRow(int index)
 {
     Index    = index;
     Cells    = new BinarySortedList <WidgetTableCell> ();
     SizeMode = TableSizeModes.Content;
 }