Exemplo n.º 1
0
        public SegmentIterator GetEnumerator()
        {
            global::System.IntPtr cPtr = PocketSphinxPINVOKE.SegmentList_GetEnumerator(swigCPtr);
            SegmentIterator       ret  = (cPtr == global::System.IntPtr.Zero) ? null : new SegmentIterator(cPtr, true);

            return(ret);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sets the time range bounds for the cell pass filter to return relevant cell passes for
        /// </summary>
        /// <param name="hasTimeFilter"></param>
        /// <param name="iteratorStartTime"></param>
        /// <param name="iteratorEndTime"></param>
        public void SetTimeRange(bool hasTimeFilter, DateTime iteratorStartTime, DateTime iteratorEndTime)
        {
            IteratorStartTime = hasTimeFilter ? iteratorStartTime: Consts.MIN_DATETIME_AS_UTC;
            IteratorEndTime   = hasTimeFilter ? iteratorEndTime : Consts.MAX_DATETIME_AS_UTC;

            // if we have a attached segment iterator then also set its date range
            SegmentIterator?.SetTimeRange(iteratorStartTime, iteratorEndTime);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Moves to the next segment in the list of segments the cell pass iterator is iterating over
        /// </summary>
        protected void MoveToNextSegment()
        {
            SegmentIterator.MoveToNextSubGridSegment();

            if (SegmentIterator.CurrentSubGridSegment != null)
            {
                InitialiseForNewSegment();
            }
            else
            {
                cellInSegmentIndex = finishCellInSegmentIndex;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initialise the cell pass iterator using the segment iterator given to it
        /// </summary>
        public void Initialise()
        {
            if (SegmentIterator == null)
            {
                throw new TRexSubGridProcessingException("No segment iterator assigned");
            }

            lastReturnedCellPassTime = SegmentIterator.IterationDirection == IterationDirection.Forwards
              ? Consts.MIN_DATETIME_AS_UTC
              : Consts.MAX_DATETIME_AS_UTC;

            SegmentIterator.InitialiseIterator();
            SegmentIterator.MoveToFirstSubGridSegment();

            if (SegmentIterator.CurrentSubGridSegment != null)
            {
                InitialiseForNewSegment();
            }
        }
Exemplo n.º 5
0
 public void Copy(int startIndex, int length, T[] array, int arrayStartIndex)
 {
     Validate.Begin().IsNotNull <T[]>(array, "array").Check().IsNotNegative(startIndex, "startIndex").IsNotNegative(length, "length").Check().IsRangeValid(this.Count, startIndex, length, "this").IsRangeValid(array.Length, arrayStartIndex, length, "array").Check();
     if (length != 0)
     {
         int num = startIndex + length;
         int destinationIndex         = arrayStartIndex;
         SegmentIterator <T> iterator = new SegmentIterator <T>((SegmentedList <T>) this, startIndex);
         int count = length;
         while (iterator.ListIndex < num)
         {
             int segmentSubIndex = iterator.SegmentSubIndex;
             int num5            = iterator.ClampForwardCountToListEndOrNextSegment(count);
             Array.Copy(iterator.Segment, segmentSubIndex, array, destinationIndex, num5);
             count              -= num5;
             destinationIndex   += num5;
             iterator.ListIndex += num5;
         }
     }
 }
Exemplo n.º 6
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SegmentIterator obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Sets the range of elevations for which cell passes will be returned in this iteration
 /// </summary>
 /// <param name="minElevation"></param>
 /// <param name="maxElevation"></param>
 public void SetIteratorElevationRange(double minElevation, double maxElevation) =>
 SegmentIterator.SetIteratorElevationRange(minElevation, maxElevation);
 public void SetUp()
 {
     _puzzle   = new Puzzle(_testPuzzle);
     _iterator = new SegmentIterator(_puzzle);
 }