コード例 #1
0
        /// <summary>
        /// getActiveSegment(c, i, t, state)
        /// For the given column c cell i, return a segment index such that
        /// segmentActive(s,t, state) is true. If multiple segments are active, sequence
        /// segments are given preference. Otherwise, segments with most activity
        /// are given preference.
        /// </summary>
        /// <param name="cell"></param>
        /// <param name="time"> </param>
        /// <returns></returns>
        public HtmSegment GetActiveSegment(HtmCellState cell, HtmTime time)
        {
            var activeSegments = cell.Segments.Where(segment => segment.IsActive(time)).ToList();

            if (activeSegments.Count == 0)
            {
                return(null);
            }

            activeSegments.Sort(new SegmentComparer(time));
            return(activeSegments.First());
        }
コード例 #2
0
ファイル: HtmCell.cs プロジェクト: chandusekhar/htm-sharp
 public HtmCell()
 {
     _oldState = new HtmCellState();
     _newState = new HtmCellState();
 }