コード例 #1
0
        internal int Offset(IValueIter vi)
        {
            // Find which of the mOffset correspond
            // to this ValueIter. Use cache info when available.
            int iterIdx = vi.GetIndexCache(this);

            if (iterIdx != -1)
            {
                return(mStartOffset[iterIdx]);
            }

            // Not in the cache, so do a sequential
            // search for the right mOffset.
            for (int i = 0; i < mValueIter.Length; i++)
            {
                if (vi.Equals(mValueIter[i]))
                {
                    vi.SetIndexCache(this, i);
                    return(mStartOffset[i]);
                }
            }

            // Attempt to use this Index on a Variable or Timeseries
            // that is not part of the Iter object.
            throw new Exception("Variable not accessible with this index");
        }
コード例 #2
0
ファイル: Index.cs プロジェクト: royratcliffe/ta-lib
        internal int Offset(IValueIter vi)
        {
            // Find which of the mOffset correspond
            // to this ValueIter. Use cache info when available.
            int iterIdx = vi.GetIndexCache(this);
            if (iterIdx != -1)
                return mStartOffset[iterIdx];

            // Not in the cache, so do a sequential
            // search for the right mOffset.
            for (int i = 0; i < mValueIter.Length; i++)
            {
                if (vi.Equals(mValueIter[i]))
                {
                    vi.SetIndexCache(this, i);
                    return mStartOffset[i];
                }
            }

            // Attempt to use this Index on a Variable or Timeseries
            // that is not part of the Iter object.
            throw new Exception("Variable not accessible with this index");
        }