static void Main(string[] args)
    {
        BaseArray baseArray = new BaseArray();
        SubArray  subArray  = new SubArray(baseArray);

        Console.Read();
    }
Exemple #2
0
    static void Main(string[] args)
    {
        #region 값 형식, 참조 형식 제약조건
        StructArray <int> a = new StructArray <int>(3);  // T는 값 형식이어야 한다.
        a.Array[0] = 0;
        a.Array[1] = 1;
        a.Array[2] = 2;
        //StructArray<string> s = new StructArray<string>(3);  // error

        RefArray <StructArray <double> > b = new RefArray <StructArray <double> >(3);
        b.Array[0] = new StructArray <double>(5);
        b.Array[1] = new StructArray <double>(10);
        b.Array[2] = new StructArray <double>(15);
        //RefArray<int> i = new RefArray<int>(3);  // error
        #endregion

        BaseArray <Base> c = new BaseArray <Base>(3);
        c.Array[0] = new Base();
        c.Array[1] = new Derived();
        c.Array[2] = CreateInstance <Base>();

        BaseArray <Derived> d = new BaseArray <Derived>(2);
        d.Array[0] = new Derived();  // Base 형식은 여기에 할달 할 수 없다.
        d.Array[1] = CreateInstance <Derived>();

        BaseArray <Derived> e = new BaseArray <Derived>(2);
        e.CopyArray <Derived>(d.Array);
    }
 public void CurrentTest()
 {
     var target = new BaseArray<string>();
     target.AddRecord("test");
     const string val = "test";
     Assert.AreEqual(val, target.Current, "Kfd.Tools.BaseArray<T>.Current was not set correctly.");
 }
Exemple #4
0
    public static void Main(string[] args)
    {
        StructArray <int> a = new StructArray <int>(3);

        a.Array[0] = 0;
        a.Array[1] = 1;
        a.Array[2] = 2;

        RefArray <StructArray <double> > b = new RefArray <StructArray <double> >(3);

        b.Array[0] = new StructArray <double>(5);
        b.Array[1] = new StructArray <double>(10);
        b.Array[2] = new StructArray <double>(1005);

        BaseArray <Base> c = new BaseArray <Base>(3);

        c.Array[0] = new Base();
        c.Array[1] = new Derived();
        c.Array[2] = CreateInstance <Base>();

        BaseArray <Derived> d = new BaseArray <Derived>(3);

        d.Array[0] = new Derived();
        d.Array[1] = CreateInstance <Derived>();
        d.Array[2] = CreateInstance <Derived>();

        BaseArray <Derived> e = new BaseArray <Derived>(3);

        e.CopyArray <Derived>(d.Array);
    }
 public void GetCountTest()
 {
     var target = new BaseArray<int>();
     target.AddRecord(1);
     target.AddRecord(2);
     target.AddRecord(3);
     Assert.AreEqual(3, target.Count());
 }
        computeBWT(BaseArray T, LongArray SA, BaseArray C, BaseArray B, long n, long k)
        {
            long b, i, j, pidx = -1;
            long c0, c1;

            /* compute SAl */
            if (C == B)
            {
                getCounts(T, C, n, k);
            }
            getBuckets(C, B, k, false); /* find starts of buckets */
            j       = n - 1;
            b       = B[c1 = T[j]];
            SA[b++] = ((0 < j) && (T[j - 1] < c1)) ? ~j : j;
            for (i = 0; i < n; ++i)
            {
                if (0 < (j = SA[i]))
                {
                    SA[i] = ~(c0 = T[--j]);
                    if (c0 != c1)
                    {
                        B[c1] = b; b = B[c1 = c0];
                    }
                    SA[b++] = ((0 < j) && (T[j - 1] < c1)) ? ~j : j;
                }
                else if (j != 0)
                {
                    SA[i] = ~j;
                }
            }
            /* compute SAs */
            if (C == B)
            {
                getCounts(T, C, n, k);
            }
            getBuckets(C, B, k, true); /* find ends of buckets */
            for (i = n - 1, b = B[c1 = 0]; 0 <= i; --i)
            {
                if (0 < (j = SA[i]))
                {
                    SA[i] = (c0 = T[--j]);
                    if (c0 != c1)
                    {
                        B[c1] = b; b = B[c1 = c0];
                    }
                    SA[--b] = ((0 < j) && (T[j - 1] > c1)) ? ~((int)T[j - 1]) : j;
                }
                else if (j != 0)
                {
                    SA[i] = ~j;
                }
                else
                {
                    pidx = i;
                }
            }
            return(pidx);
        }
            /// <inheritdoc/>
            public void Insert(TValue value, long index)
            {
                changed = true;
                var arr = GetArray(false);

                BaseArray.CopyTo(index, arr, index + 1, (count - index));
                ++count;
                arr[index] = value;
            }
Exemple #8
0
 private void PrepareMutate(bool readOnly)
 {
     // If list is to be mutable
     if (!readOnly && !mutableBlock)
     {
         BaseArray    = (int[])BaseArray.Clone();
         mutableBlock = true;
     }
 }
Exemple #9
0
        static int ComputeBWT(BaseArray T, int[] SA, BaseArray C, BaseArray B, int n, int k)
        {
            int b, i, j, pidx = -1;
            int c0, c1;

            if (C == B)
            {
                GetCounts(T, C, n, k);
            }
            GetBuckets(C, B, k, false);
            j       = n - 1;
            b       = B[c1 = T[j]];
            SA[b++] = ((0 < j) && (T[j - 1] < c1)) ? ~j : j;
            for (i = 0; i < n; ++i)
            {
                if (0 < (j = SA[i]))
                {
                    SA[i] = ~(c0 = T[--j]);
                    if (c0 != c1)
                    {
                        B[c1] = b; b = B[c1 = c0];
                    }
                    SA[b++] = ((0 < j) && (T[j - 1] < c1)) ? ~j : j;
                }
                else if (j != 0)
                {
                    SA[i] = ~j;
                }
            }
            if (C == B)
            {
                GetCounts(T, C, n, k);
            }
            GetBuckets(C, B, k, true);
            for (i = n - 1, b = B[c1 = 0]; 0 <= i; --i)
            {
                if (0 < (j = SA[i]))
                {
                    SA[i] = (c0 = T[--j]);
                    if (c0 != c1)
                    {
                        B[c1] = b; b = B[c1 = c0];
                    }
                    SA[--b] = ((0 < j) && (T[j - 1] > c1)) ? ~((int)T[j - 1]) : j;
                }
                else if (j != 0)
                {
                    SA[i] = ~j;
                }
                else
                {
                    pidx = i;
                }
            }
            return(pidx);
        }
 public void DeleteAllTest()
 {
     var target = new BaseArray<int>();
     target.AddRecord(1);
     target.AddRecord(2);
     target.AddRecord(3);
     Assert.AreEqual(3, target.Count());
     target.DeleteAll();
     Assert.AreEqual(0, target.Count());
 }
 protected virtual BigArray <TValue> GetArray(bool readOnly)
 {
     if (readOnly)
     {
         var newArray = new BigArray <TValue>(BaseArray.Length);
         BaseArray.CopyTo(0, newArray, 0, BaseArray.Length);
         return(newArray);
     }
     return(BaseArray);
 }
            /// <inheritdoc/>
            public TValue RemoveAt(long index)
            {
                changed = true;
                var arr = GetArray(false);
                var val = arr[index];

                BaseArray.CopyTo(index + 1, arr, index, (count - index));
                --count;
                return(val);
            }
 public void DeleteRecordTest()
 {
     var target = new BaseArray<int>();
     const int nIndex = 0;
     target.AddRecord(1);
     target.AddRecord(2);
     target.AddRecord(3);
     target.DeleteRecord(nIndex);
     Assert.AreEqual(2, target.Count());
     target.SetCurrent(0);
     Assert.AreEqual(2, target.Current);
 }
        static void Main(string[] args)
        {
            // Initializations used for testing purposes
            BaseArray baseArray = new BaseArray();
            SubArray  subArray  = new SubArray();

            // Example of assignment
            baseArray[3, 4]   = 3;
            subArray[4][2, 3] = 4;
            subArray[4][2]    = 3;  // Weakness: compiles, but causes IndexOutOfRangeException
            Console.Read();
        }
        LMSsort(BaseArray T, LongArray SA, BaseArray C, BaseArray B, long n, long k)
        {
            long b, i, j;
            long c0, c1;

            /* compute SAl */
            if (C == B)
            {
                getCounts(T, C, n, k);
            }
            getBuckets(C, B, k, false); /* find starts of buckets */
            j = n - 1;
            b = B[c1 = T[j]];
            --j;
            SA[b++] = (T[j] < c1) ? ~j : j;
            for (i = 0; i < n; ++i)
            {
                if (0 < (j = SA[i]))
                {
                    if ((c0 = T[j]) != c1)
                    {
                        B[c1] = b; b = B[c1 = c0];
                    }
                    --j;
                    SA[b++] = (T[j] < c1) ? ~j : j;
                    SA[i]   = 0;
                }
                else if (j < 0)
                {
                    SA[i] = ~j;
                }
            }
            /* compute SAs */
            if (C == B)
            {
                getCounts(T, C, n, k);
            }
            getBuckets(C, B, k, true); /* find ends of buckets */
            for (i = n - 1, b = B[c1 = 0]; 0 <= i; --i)
            {
                if (0 < (j = SA[i]))
                {
                    if ((c0 = T[j]) != c1)
                    {
                        B[c1] = b; b = B[c1 = c0];
                    }
                    --j;
                    SA[--b] = (T[j] > c1) ? ~(j + 1) : j;
                    SA[i]   = 0;
                }
            }
        }
        getCounts(BaseArray T, BaseArray C, long n, long k)
        {
            long i;

            for (i = 0; i < k; ++i)
            {
                C[i] = 0;
            }
            for (i = 0; i < n; ++i)
            {
                C[T[i]] = C[T[i]] + 1;
            }
        }
Exemple #17
0
        getCounts(BaseArray T, BaseArray C, int n, int k)
        {
            int i;

            for (i = 0; i < k; ++i)
            {
                C[i] = 0;
            }
            for (i = 0; i < n; ++i)
            {
                C[T[i]] = C[T[i]] + 1;
            }
        }
Exemple #18
0
        static void LMSSort(BaseArray T, int[] SA, BaseArray C, BaseArray B, int n, int k)
        {
            int b, i, j;
            int c0, c1;

            if (C == B)
            {
                GetCounts(T, C, n, k);
            }
            GetBuckets(C, B, k, false);
            j = n - 1;
            b = B[c1 = T[j]];
            --j;
            SA[b++] = (T[j] < c1) ? ~j : j;
            for (i = 0; i < n; ++i)
            {
                if (0 < (j = SA[i]))
                {
                    if ((c0 = T[j]) != c1)
                    {
                        B[c1] = b; b = B[c1 = c0];
                    }
                    --j;
                    SA[b++] = (T[j] < c1) ? ~j : j;
                    SA[i]   = 0;
                }
                else if (j < 0)
                {
                    SA[i] = ~j;
                }
            }
            if (C == B)
            {
                GetCounts(T, C, n, k);
            }
            GetBuckets(C, B, k, true);
            for (i = n - 1, b = B[c1 = 0]; 0 <= i; --i)
            {
                if (0 < (j = SA[i]))
                {
                    if ((c0 = T[j]) != c1)
                    {
                        B[c1] = b; b = B[c1 = c0];
                    }
                    --j;
                    SA[--b] = (T[j] > c1) ? ~(j + 1) : j;
                    SA[i]   = 0;
                }
            }
        }
        induceSA(BaseArray T, LongArray SA, BaseArray C, BaseArray B, long n, long k)
        {
            long b, i, j;
            long c0, c1;

            /* compute SAl */
            if (C == B)
            {
                getCounts(T, C, n, k);
            }
            getBuckets(C, B, k, false); /* find starts of buckets */
            j       = n - 1;
            b       = B[c1 = T[j]];
            SA[b++] = ((0 < j) && (T[j - 1] < c1)) ? ~j : j;
            for (i = 0; i < n; ++i)
            {
                j = SA[i]; SA[i] = ~j;
                if (0 < j)
                {
                    if ((c0 = T[--j]) != c1)
                    {
                        B[c1] = b; b = B[c1 = c0];
                    }
                    SA[b++] = ((0 < j) && (T[j - 1] < c1)) ? ~j : j;
                }
            }
            /* compute SAs */
            if (C == B)
            {
                getCounts(T, C, n, k);
            }
            getBuckets(C, B, k, true); /* find ends of buckets */
            for (i = n - 1, b = B[c1 = 0]; 0 <= i; --i)
            {
                if (0 < (j = SA[i]))
                {
                    if ((c0 = T[--j]) != c1)
                    {
                        B[c1] = b; b = B[c1 = c0];
                    }
                    SA[--b] = ((j == 0) || (T[j - 1] > c1)) ? ~j : j;
                }
                else
                {
                    SA[i] = ~j;
                }
            }
        }
Exemple #20
0
        static void InduceSA(BaseArray T, int[] SA, BaseArray C, BaseArray B, int n, int k)
        {
            int b, i, j;
            int c0, c1;

            if (C == B)
            {
                GetCounts(T, C, n, k);
            }
            GetBuckets(C, B, k, false);
            j       = n - 1;
            b       = B[c1 = T[j]];
            SA[b++] = ((0 < j) && (T[j - 1] < c1)) ? ~j : j;
            for (i = 0; i < n; ++i)
            {
                j = SA[i]; SA[i] = ~j;
                if (0 < j)
                {
                    if ((c0 = T[--j]) != c1)
                    {
                        B[c1] = b; b = B[c1 = c0];
                    }
                    SA[b++] = ((0 < j) && (T[j - 1] < c1)) ? ~j : j;
                }
            }
            if (C == B)
            {
                GetCounts(T, C, n, k);
            }
            GetBuckets(C, B, k, true);
            for (i = n - 1, b = B[c1 = 0]; 0 <= i; --i)
            {
                if (0 < (j = SA[i]))
                {
                    if ((c0 = T[--j]) != c1)
                    {
                        B[c1] = b; b = B[c1 = c0];
                    }
                    SA[--b] = ((j == 0) || (T[j - 1] > c1)) ? ~j : j;
                }
                else
                {
                    SA[i] = ~j;
                }
            }
        }
Exemple #21
0
        static void Main(string[] args)
        {
            StructArray <int> a = new StructArray <int>(3);

            a.Array[0] = 1;
            a.Array[1] = 3;
            a.Array[2] = 4;
            for (int i = 0; i < a.Array.Length; i++)
            {
                Console.WriteLine(a.Array[i]);
            }

            RefArray <StructArray <double> > b = new RefArray <StructArray <double> >(3);

            b.Array[0]          = new StructArray <double>(5);
            b.Array[0].Array[0] = 1;
            b.Array[0].Array[1] = 1;
            b.Array[0].Array[2] = 1;
            b.Array[0].Array[3] = 1;
            b.Array[0].Array[4] = 1;

            b.Array[1] = new StructArray <double>(10);
            b.Array[2] = new StructArray <double>(105);
            for (int i = 0; i < b.Array.Length; i++)
            {
                Console.WriteLine(b.Array[0].Array[i]);
            }

            BaseArray <Base> c = new BaseArray <Base>(3);

            c.Array[0] = new Base();
            c.Array[1] = new Derived();
            c.Array[2] = CreateInstance <Base>();

            BaseArray <Derived> d = new BaseArray <Derived>(3);

            d.Array[0] = new Derived();
            d.Array[1] = CreateInstance <Derived>();
            d.Array[2] = CreateInstance <Derived>();

            BaseArray <Derived> e = new BaseArray <Derived>(3);

            e.CopyArray <Derived>(d.Array);
        }
Exemple #22
0
        static void GetBuckets(BaseArray C, BaseArray B, int k, bool end)
        {
            int i, sum = 0;

            if (end != false)
            {
                for (i = 0; i < k; ++i)
                {
                    sum += C[i]; B[i] = sum;
                }
            }
            else
            {
                for (i = 0; i < k; ++i)
                {
                    sum += C[i]; B[i] = sum - C[i];
                }
            }
        }
        getBuckets(BaseArray C, BaseArray B, long k, bool end)
        {
            long i, sum = 0;

            if (end != false)
            {
                for (i = 0; i < k; ++i)
                {
                    sum += C[i]; B[i] = sum;
                }
            }
            else
            {
                for (i = 0; i < k; ++i)
                {
                    sum += C[i]; B[i] = sum - C[i];
                }
            }
        }
Exemple #24
0
        public override bool Equals(object obj)
        {
            if (obj == null ||
                !obj.GetType().Equals(GetType()))
            {
                return(false);
            }

            IEnumerator <PdfDirectObject> objectIterator = ((LeveledColor)obj).BaseArray.GetEnumerator();
            IEnumerator <PdfDirectObject> thisIterator   = BaseArray.GetEnumerator();

            while (thisIterator.MoveNext())
            {
                objectIterator.MoveNext();
                if (!thisIterator.Current.Equals(objectIterator.Current))
                {
                    return(false);
                }
            }
            return(true);
        }
Exemple #25
0
        static int SAISMain(BaseArray T, int[] SA, int fs, int n, int k, bool isbwt)
        {
            BaseArray C, B, RA;
            int       i, j, b, m, p, q, name, pidx = 0, newfs;
            int       c0, c1;
            uint      flags = 0;

            if (k <= MINBUCKETSIZE)
            {
                C = new IntArray(new int[k], 0);
                if (k <= fs)
                {
                    B = new IntArray(SA, n + fs - k); flags = 1;
                }
                else
                {
                    B = new IntArray(new int[k], 0); flags = 3;
                }
            }
            else if (k <= fs)
            {
                C = new IntArray(SA, n + fs - k);
                if (k <= (fs - k))
                {
                    B = new IntArray(SA, n + fs - k * 2); flags = 0;
                }
                else if (k <= (MINBUCKETSIZE * 4))
                {
                    B = new IntArray(new int[k], 0); flags = 2;
                }
                else
                {
                    B = C; flags = 8;
                }
            }
            else
            {
                C     = B = new IntArray(new int[k], 0);
                flags = 4 | 8;
            }
            GetCounts(T, C, n, k); GetBuckets(C, B, k, true);
            for (i = 0; i < n; ++i)
            {
                SA[i] = 0;
            }
            b = -1; i = n - 1; j = n; m = 0; c0 = T[n - 1];
            do
            {
                c1 = c0;
            } while ((0 <= --i) && ((c0 = T[i]) >= c1));
            for (; 0 <= i;)
            {
                do
                {
                    c1 = c0;
                } while ((0 <= --i) && ((c0 = T[i]) <= c1));
                if (0 <= i)
                {
                    if (0 <= b)
                    {
                        SA[b] = j;
                    }
                    b = --B[c1]; j = i; ++m;
                    do
                    {
                        c1 = c0;
                    } while ((0 <= --i) && ((c0 = T[i]) >= c1));
                }
            }
            if (1 < m)
            {
                LMSSort(T, SA, C, B, n, k);
                name = LMSPostProc(T, SA, n, m);
            }
            else if (m == 1)
            {
                SA[b] = j + 1;
                name  = 1;
            }
            else
            {
                name = 0;
            }
            if (name < m)
            {
                if ((flags & 4) != 0)
                {
                    C = null; B = null;
                }
                if ((flags & 2) != 0)
                {
                    B = null;
                }
                newfs = (n + fs) - (m * 2);
                if ((flags & (1 | 4 | 8)) == 0)
                {
                    if ((k + name) <= newfs)
                    {
                        newfs -= k;
                    }
                    else
                    {
                        flags |= 8;
                    }
                }
                for (i = m + (n >> 1) - 1, j = m * 2 + newfs - 1; m <= i; --i)
                {
                    if (SA[i] != 0)
                    {
                        SA[j--] = SA[i] - 1;
                    }
                }
                RA = new IntArray(SA, m + newfs);
                SAISMain(RA, SA, newfs, m, name, false);
                RA = null;
                i  = n - 1; j = m * 2 - 1; c0 = T[n - 1];
                do
                {
                    c1 = c0;
                } while ((0 <= --i) && ((c0 = T[i]) >= c1));
                for (; 0 <= i;)
                {
                    do
                    {
                        c1 = c0;
                    } while ((0 <= --i) && ((c0 = T[i]) <= c1));
                    if (0 <= i)
                    {
                        SA[j--] = i + 1;
                        do
                        {
                            c1 = c0;
                        } while ((0 <= --i) && ((c0 = T[i]) >= c1));
                    }
                }

                for (i = 0; i < m; ++i)
                {
                    SA[i] = SA[m + SA[i]];
                }
                if ((flags & 4) != 0)
                {
                    C = B = new IntArray(new int[k], 0);
                }
                if ((flags & 2) != 0)
                {
                    B = new IntArray(new int[k], 0);
                }
            }
            if ((flags & 8) != 0)
            {
                GetCounts(T, C, n, k);
            }
            if (1 < m)
            {
                GetBuckets(C, B, k, true);
                i = m - 1; j = n; p = SA[m - 1]; c1 = T[p];
                do
                {
                    q = B[c0 = c1];
                    while (q < j)
                    {
                        SA[--j] = 0;
                    }
                    do
                    {
                        SA[--j] = p;
                        if (--i < 0)
                        {
                            break;
                        }
                        p = SA[i];
                    } while ((c1 = T[p]) == c0);
                } while (0 <= i);
                while (0 < j)
                {
                    SA[--j] = 0;
                }
            }
            if (isbwt == false)
            {
                InduceSA(T, SA, C, B, n, k);
            }
            else
            {
                pidx = ComputeBWT(T, SA, C, B, n, k);
            }
            C = null; B = null;
            return(pidx);
        }
 public void GetEnumeratorTest()
 {
     var target = new BaseArray<int>();
     target.AddRecord(1);
     target.AddRecord(2);
     target.AddRecord(3);
     const int expected = 3;
     int actual = target.Count();
     Assert.AreEqual(expected, actual, "Kfd.Tools.BaseArray<T>.GetEnumerator did not return the expected value.");
 }
Exemple #27
0
 getBuckets(BaseArray C, BaseArray B, int k, bool end)
 {
   int i, sum = 0;
   if (end != false) { for (i = 0; i < k; ++i) { sum += C[i]; B[i] = sum; } }
   else { for (i = 0; i < k; ++i) { sum += C[i]; B[i] = sum - C[i]; } }
 }
Exemple #28
0
 getCounts(BaseArray T, BaseArray C, int n, int k)
 {
   int i;
   for (i = 0; i < k; ++i) { C[i] = 0; }
   for (i = 0; i < n; ++i) { C[T[i]] = C[T[i]] + 1; }
 }
Exemple #29
0
        /// <inheritdoc />
        public bool Equals([AllowNull] BarPolar other)
        {
            if (other == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                     ) &&
                 (
                     Visible == other.Visible ||
                     Visible != null &&
                     Visible.Equals(other.Visible)
                 ) &&
                 (
                     ShowLegend == other.ShowLegend ||
                     ShowLegend != null &&
                     ShowLegend.Equals(other.ShowLegend)
                 ) &&
                 (
                     LegendGroup == other.LegendGroup ||
                     LegendGroup != null &&
                     LegendGroup.Equals(other.LegendGroup)
                 ) &&
                 (
                     Opacity == other.Opacity ||
                     Opacity != null &&
                     Opacity.Equals(other.Opacity)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     UId == other.UId ||
                     UId != null &&
                     UId.Equals(other.UId)
                 ) &&
                 (
                     Equals(Ids, other.Ids) ||
                     Ids != null && other.Ids != null &&
                     Ids.SequenceEqual(other.Ids)
                 ) &&
                 (
                     Equals(CustomData, other.CustomData) ||
                     CustomData != null && other.CustomData != null &&
                     CustomData.SequenceEqual(other.CustomData)
                 ) &&
                 (
                     Meta == other.Meta ||
                     Meta != null &&
                     Meta.Equals(other.Meta)
                 ) &&
                 (
                     Equals(MetaArray, other.MetaArray) ||
                     MetaArray != null && other.MetaArray != null &&
                     MetaArray.SequenceEqual(other.MetaArray)
                 ) &&
                 (
                     SelectedPoints == other.SelectedPoints ||
                     SelectedPoints != null &&
                     SelectedPoints.Equals(other.SelectedPoints)
                 ) &&
                 (
                     HoverLabel == other.HoverLabel ||
                     HoverLabel != null &&
                     HoverLabel.Equals(other.HoverLabel)
                 ) &&
                 (
                     Stream == other.Stream ||
                     Stream != null &&
                     Stream.Equals(other.Stream)
                 ) &&
                 (
                     Equals(Transforms, other.Transforms) ||
                     Transforms != null && other.Transforms != null &&
                     Transforms.SequenceEqual(other.Transforms)
                 ) &&
                 (
                     UiRevision == other.UiRevision ||
                     UiRevision != null &&
                     UiRevision.Equals(other.UiRevision)
                 ) &&
                 (
                     Equals(R, other.R) ||
                     R != null && other.R != null &&
                     R.SequenceEqual(other.R)
                 ) &&
                 (
                     Equals(Theta, other.Theta) ||
                     Theta != null && other.Theta != null &&
                     Theta.SequenceEqual(other.Theta)
                 ) &&
                 (
                     R0 == other.R0 ||
                     R0 != null &&
                     R0.Equals(other.R0)
                 ) &&
                 (
                     Dr == other.Dr ||
                     Dr != null &&
                     Dr.Equals(other.Dr)
                 ) &&
                 (
                     Theta0 == other.Theta0 ||
                     Theta0 != null &&
                     Theta0.Equals(other.Theta0)
                 ) &&
                 (
                     DTheta == other.DTheta ||
                     DTheta != null &&
                     DTheta.Equals(other.DTheta)
                 ) &&
                 (
                     ThetaUnit == other.ThetaUnit ||
                     ThetaUnit != null &&
                     ThetaUnit.Equals(other.ThetaUnit)
                 ) &&
                 (
                     Base == other.Base ||
                     Base != null &&
                     Base.Equals(other.Base)
                 ) &&
                 (
                     Equals(BaseArray, other.BaseArray) ||
                     BaseArray != null && other.BaseArray != null &&
                     BaseArray.SequenceEqual(other.BaseArray)
                 ) &&
                 (
                     Offset == other.Offset ||
                     Offset != null &&
                     Offset.Equals(other.Offset)
                 ) &&
                 (
                     Equals(OffsetArray, other.OffsetArray) ||
                     OffsetArray != null && other.OffsetArray != null &&
                     OffsetArray.SequenceEqual(other.OffsetArray)
                 ) &&
                 (
                     Width == other.Width ||
                     Width != null &&
                     Width.Equals(other.Width)
                 ) &&
                 (
                     Equals(WidthArray, other.WidthArray) ||
                     WidthArray != null && other.WidthArray != null &&
                     WidthArray.SequenceEqual(other.WidthArray)
                 ) &&
                 (
                     Text == other.Text ||
                     Text != null &&
                     Text.Equals(other.Text)
                 ) &&
                 (
                     Equals(TextArray, other.TextArray) ||
                     TextArray != null && other.TextArray != null &&
                     TextArray.SequenceEqual(other.TextArray)
                 ) &&
                 (
                     HoverText == other.HoverText ||
                     HoverText != null &&
                     HoverText.Equals(other.HoverText)
                 ) &&
                 (
                     Equals(HoverTextArray, other.HoverTextArray) ||
                     HoverTextArray != null && other.HoverTextArray != null &&
                     HoverTextArray.SequenceEqual(other.HoverTextArray)
                 ) &&
                 (
                     Marker == other.Marker ||
                     Marker != null &&
                     Marker.Equals(other.Marker)
                 ) &&
                 (
                     HoverInfo == other.HoverInfo ||
                     HoverInfo != null &&
                     HoverInfo.Equals(other.HoverInfo)
                 ) &&
                 (
                     Equals(HoverInfoArray, other.HoverInfoArray) ||
                     HoverInfoArray != null && other.HoverInfoArray != null &&
                     HoverInfoArray.SequenceEqual(other.HoverInfoArray)
                 ) &&
                 (
                     HoverTemplate == other.HoverTemplate ||
                     HoverTemplate != null &&
                     HoverTemplate.Equals(other.HoverTemplate)
                 ) &&
                 (
                     Equals(HoverTemplateArray, other.HoverTemplateArray) ||
                     HoverTemplateArray != null && other.HoverTemplateArray != null &&
                     HoverTemplateArray.SequenceEqual(other.HoverTemplateArray)
                 ) &&
                 (
                     Selected == other.Selected ||
                     Selected != null &&
                     Selected.Equals(other.Selected)
                 ) &&
                 (
                     Unselected == other.Unselected ||
                     Unselected != null &&
                     Unselected.Equals(other.Unselected)
                 ) &&
                 (
                     Subplot == other.Subplot ||
                     Subplot != null &&
                     Subplot.Equals(other.Subplot)
                 ) &&
                 (
                     IdsSrc == other.IdsSrc ||
                     IdsSrc != null &&
                     IdsSrc.Equals(other.IdsSrc)
                 ) &&
                 (
                     CustomDataSrc == other.CustomDataSrc ||
                     CustomDataSrc != null &&
                     CustomDataSrc.Equals(other.CustomDataSrc)
                 ) &&
                 (
                     MetaSrc == other.MetaSrc ||
                     MetaSrc != null &&
                     MetaSrc.Equals(other.MetaSrc)
                 ) &&
                 (
                     RSrc == other.RSrc ||
                     RSrc != null &&
                     RSrc.Equals(other.RSrc)
                 ) &&
                 (
                     ThetaSrc == other.ThetaSrc ||
                     ThetaSrc != null &&
                     ThetaSrc.Equals(other.ThetaSrc)
                 ) &&
                 (
                     BaseSrc == other.BaseSrc ||
                     BaseSrc != null &&
                     BaseSrc.Equals(other.BaseSrc)
                 ) &&
                 (
                     OffsetSrc == other.OffsetSrc ||
                     OffsetSrc != null &&
                     OffsetSrc.Equals(other.OffsetSrc)
                 ) &&
                 (
                     WidthSrc == other.WidthSrc ||
                     WidthSrc != null &&
                     WidthSrc.Equals(other.WidthSrc)
                 ) &&
                 (
                     TextSrc == other.TextSrc ||
                     TextSrc != null &&
                     TextSrc.Equals(other.TextSrc)
                 ) &&
                 (
                     HoverTextSrc == other.HoverTextSrc ||
                     HoverTextSrc != null &&
                     HoverTextSrc.Equals(other.HoverTextSrc)
                 ) &&
                 (
                     HoverInfoSrc == other.HoverInfoSrc ||
                     HoverInfoSrc != null &&
                     HoverInfoSrc.Equals(other.HoverInfoSrc)
                 ) &&
                 (
                     HoverTemplateSrc == other.HoverTemplateSrc ||
                     HoverTemplateSrc != null &&
                     HoverTemplateSrc.Equals(other.HoverTemplateSrc)
                 ));
        }
Exemple #30
0
        static int LMSPostProc(BaseArray T, int[] SA, int n, int m)
        {
            int  i, j, p, q, plen, qlen, name;
            int  c0, c1;
            bool diff;

            for (i = 0; (p = SA[i]) < 0; ++i)
            {
                SA[i] = ~p;
            }
            if (i < m)
            {
                for (j = i, ++i; ; ++i)
                {
                    if ((p = SA[i]) < 0)
                    {
                        SA[j++] = ~p; SA[i] = 0;
                        if (j == m)
                        {
                            break;
                        }
                    }
                }
            }
            i = n - 1; j = n - 1; c0 = T[n - 1];
            do
            {
                c1 = c0;
            } while ((0 <= --i) && ((c0 = T[i]) >= c1));
            for (; 0 <= i;)
            {
                do
                {
                    c1 = c0;
                } while ((0 <= --i) && ((c0 = T[i]) <= c1));
                if (0 <= i)
                {
                    SA[m + ((i + 1) >> 1)] = j - i; j = i + 1;
                    do
                    {
                        c1 = c0;
                    } while ((0 <= --i) && ((c0 = T[i]) >= c1));
                }
            }
            for (i = 0, name = 0, q = n, qlen = 0; i < m; ++i)
            {
                p = SA[i]; plen = SA[m + (p >> 1)]; diff = true;
                if ((plen == qlen) && ((q + plen) < n))
                {
                    for (j = 0; (j < plen) && (T[p + j] == T[q + j]); ++j)
                    {
                    }
                    if (j == plen)
                    {
                        diff = false;
                    }
                }
                if (diff != false)
                {
                    ++name; q = p; qlen = plen;
                }
                SA[m + (p >> 1)] = name;
            }
            return(name);
        }
Exemple #31
0
    LMSpostproc(BaseArray T, int[] SA, int n, int m)
    {
      int i, j, p, q, plen, qlen, name;
      int c0, c1;
      bool diff;

      /* compact all the sorted substrings into the first m items of SA
          2*m must be not larger than n (proveable) */
      for (i = 0; (p = SA[i]) < 0; ++i) { SA[i] = ~p; }
      if (i < m)
      {
        for (j = i, ++i; ; ++i)
        {
          if ((p = SA[i]) < 0)
          {
            SA[j++] = ~p; SA[i] = 0;
            if (j == m) { break; }
          }
        }
      }

      /* store the length of all substrings */
      i = n - 1; j = n - 1; c0 = T[n - 1];
      do { c1 = c0; } while ((0 <= --i) && ((c0 = T[i]) >= c1));
      for (; 0 <= i; )
      {
        do { c1 = c0; } while ((0 <= --i) && ((c0 = T[i]) <= c1));
        if (0 <= i)
        {
          SA[m + ((i + 1) >> 1)] = j - i; j = i + 1;
          do { c1 = c0; } while ((0 <= --i) && ((c0 = T[i]) >= c1));
        }
      }

      /* find the lexicographic names of all substrings */
      for (i = 0, name = 0, q = n, qlen = 0; i < m; ++i)
      {
        p = SA[i]; plen = SA[m + (p >> 1)]; diff = true;
        if ((plen == qlen) && ((q + plen) < n))
        {
          for (j = 0; (j < plen) && (T[p + j] == T[q + j]); ++j) { }
          if (j == plen) { diff = false; }
        }
        if (diff != false) { ++name; q = p; qlen = plen; }
        SA[m + (p >> 1)] = name;
      }

      return name;
    }
 public void MoveNextTest()
 {
     var target = new BaseArray<int>();
     const bool expected = false;
     bool actual = target.MoveNext();
     Assert.AreEqual(expected, actual, "Kfd.Tools.BaseArray<T>.MoveNext did not return the expected value.");
 }
Exemple #33
0
 computeBWT(BaseArray T, int[] SA, BaseArray C, BaseArray B, int n, int k)
 {
   int b, i, j, pidx = -1;
   int c0, c1;
   /* compute SAl */
   if (C == B) { getCounts(T, C, n, k); }
   getBuckets(C, B, k, false); /* find starts of buckets */
   j = n - 1;
   b = B[c1 = T[j]];
   SA[b++] = ((0 < j) && (T[j - 1] < c1)) ? ~j : j;
   for (i = 0; i < n; ++i)
   {
     if (0 < (j = SA[i]))
     {
       SA[i] = ~(c0 = T[--j]);
       if (c0 != c1) { B[c1] = b; b = B[c1 = c0]; }
       SA[b++] = ((0 < j) && (T[j - 1] < c1)) ? ~j : j;
     }
     else if (j != 0)
     {
       SA[i] = ~j;
     }
   }
   /* compute SAs */
   if (C == B) { getCounts(T, C, n, k); }
   getBuckets(C, B, k, true); /* find ends of buckets */
   for (i = n - 1, b = B[c1 = 0]; 0 <= i; --i)
   {
     if (0 < (j = SA[i]))
     {
       SA[i] = (c0 = T[--j]);
       if (c0 != c1) { B[c1] = b; b = B[c1 = c0]; }
       SA[--b] = ((0 < j) && (T[j - 1] > c1)) ? ~((int)T[j - 1]) : j;
     }
     else if (j != 0)
     {
       SA[i] = ~j;
     }
     else
     {
       pidx = i;
     }
   }
   return pidx;
 }
Exemple #34
0
 induceSA(BaseArray T, int[] SA, BaseArray C, BaseArray B, int n, int k)
 {
   int b, i, j;
   int c0, c1;
   /* compute SAl */
   if (C == B) { getCounts(T, C, n, k); }
   getBuckets(C, B, k, false); /* find starts of buckets */
   j = n - 1;
   b = B[c1 = T[j]];
   SA[b++] = ((0 < j) && (T[j - 1] < c1)) ? ~j : j;
   for (i = 0; i < n; ++i)
   {
     j = SA[i]; SA[i] = ~j;
     if (0 < j)
     {
       if ((c0 = T[--j]) != c1) { B[c1] = b; b = B[c1 = c0]; }
       SA[b++] = ((0 < j) && (T[j - 1] < c1)) ? ~j : j;
     }
   }
   /* compute SAs */
   if (C == B) { getCounts(T, C, n, k); }
   getBuckets(C, B, k, true); /* find ends of buckets */
   for (i = n - 1, b = B[c1 = 0]; 0 <= i; --i)
   {
     if (0 < (j = SA[i]))
     {
       if ((c0 = T[--j]) != c1) { B[c1] = b; b = B[c1 = c0]; }
       SA[--b] = ((j == 0) || (T[j - 1] > c1)) ? ~j : j;
     }
     else
     {
       SA[i] = ~j;
     }
   }
 }
        private void Stream( ArrayList data, BaseArray baseArray )
        {
            data.Add( new Snoop.Data.ClassSeparator( typeof( BaseArray ) ) );

              data.Add( new Snoop.Data.String( "Name", baseArray.Name ) );
              data.Add( new Snoop.Data.Int( "Number of members", baseArray.NumMembers ) );
              data.Add( new Snoop.Data.Enumerable( "Original members", baseArray.GetOriginalMemberIds(), baseArray.Document ) );
              data.Add( new Snoop.Data.Enumerable( "Copy members", baseArray.GetCopiedMemberIds(), baseArray.Document ) );

              LinearArray linearArray = baseArray as LinearArray;
              if( linearArray != null )
              {
            Stream( data, linearArray );
            return;
              }

              RadialArray radialArray = baseArray as RadialArray;
              if( radialArray != null )
              {
            Stream( data, radialArray );
            return;
              }
        }
        sais_main(BaseArray T, LongArray SA, long fs, long n, long k, bool isbwt)
        {
            BaseArray C, B, RA;
            long      i, j, b, m, p, q, name, pidx = 0, newfs;
            long      c0, c1;
            ulong     flags = 0;

            if (k <= MINBUCKETSIZE)
            {
                C = new LongArray(new MemoryEfficientByteAlignedBigULongArray(k), 0);
                if (k <= fs)
                {
                    B = new LongArray(SA, n + fs - k); flags = 1;
                }
                else
                {
                    B = new LongArray(new MemoryEfficientByteAlignedBigULongArray(k), 0); flags = 3;
                }
            }
            else if (k <= fs)
            {
                C = new LongArray(SA, n + fs - k);
                if (k <= (fs - k))
                {
                    B = new LongArray(SA, n + fs - k * 2); flags = 0;
                }
                else if (k <= (MINBUCKETSIZE * 4))
                {
                    B = new LongArray(new MemoryEfficientByteAlignedBigULongArray(k), 0); flags = 2;
                }
                else
                {
                    B = C; flags = 8;
                }
            }
            else
            {
                C     = B = new LongArray(new MemoryEfficientByteAlignedBigULongArray(k), 0);
                flags = 4 | 8;
            }

            /* stage 1: reduce the problem by at least 1/2
             * sort all the LMS-substrings */
            getCounts(T, C, n, k); getBuckets(C, B, k, true); /* find ends of buckets */
            for (i = 0; i < n; ++i)
            {
                SA[i] = 0;
            }
            b = -1; i = n - 1; j = n; m = 0; c0 = T[n - 1];
            do
            {
                c1 = c0;
            } while ((0 <= --i) && ((c0 = T[i]) >= c1));
            for (; 0 <= i;)
            {
                do
                {
                    c1 = c0;
                } while ((0 <= --i) && ((c0 = T[i]) <= c1));
                if (0 <= i)
                {
                    if (0 <= b)
                    {
                        SA[b] = j;
                    }
                    b = --B[c1]; j = i; ++m;
                    do
                    {
                        c1 = c0;
                    } while ((0 <= --i) && ((c0 = T[i]) >= c1));
                }
            }
            if (1 < m)
            {
                LMSsort(T, SA, C, B, n, k);
                name = LMSpostproc(T, SA, n, m);
            }
            else if (m == 1)
            {
                SA[b] = j + 1;
                name  = 1;
            }
            else
            {
                name = 0;
            }

            /* stage 2: solve the reduced problem
             * recurse if names are not yet unique */
            if (name < m)
            {
                if ((flags & 4) != 0)
                {
                    C = null; B = null;
                }
                if ((flags & 2) != 0)
                {
                    B = null;
                }
                newfs = (n + fs) - (m * 2);
                if ((flags & (1 | 4 | 8)) == 0)
                {
                    if ((k + name) <= newfs)
                    {
                        newfs -= k;
                    }
                    else
                    {
                        flags |= 8;
                    }
                }
                for (i = m + (n >> 1) - 1, j = m * 2 + newfs - 1; m <= i; --i)
                {
                    if (SA[i] != 0)
                    {
                        SA[j--] = SA[i] - 1;
                    }
                }
                RA = new LongArray(SA, m + newfs);
                sais_main(RA, SA, newfs, m, name, false);
                RA = null;

                i = n - 1; j = m * 2 - 1; c0 = T[n - 1];
                do
                {
                    c1 = c0;
                } while ((0 <= --i) && ((c0 = T[i]) >= c1));
                for (; 0 <= i;)
                {
                    do
                    {
                        c1 = c0;
                    } while ((0 <= --i) && ((c0 = T[i]) <= c1));
                    if (0 <= i)
                    {
                        SA[j--] = i + 1;
                        do
                        {
                            c1 = c0;
                        } while ((0 <= --i) && ((c0 = T[i]) >= c1));
                    }
                }

                for (i = 0; i < m; ++i)
                {
                    SA[i] = SA[m + SA[i]];
                }
                if ((flags & 4) != 0)
                {
                    C = B = new LongArray(new MemoryEfficientByteAlignedBigULongArray(k), 0);
                }
                if ((flags & 2) != 0)
                {
                    B = new LongArray(new MemoryEfficientByteAlignedBigULongArray(k), 0);
                }
            }

            /* stage 3: induce the result for the original problem */
            if ((flags & 8) != 0)
            {
                getCounts(T, C, n, k);
            }
            /* put all left-most S characters into their buckets */
            if (1 < m)
            {
                getBuckets(C, B, k, true); /* find ends of buckets */
                i = m - 1; j = n; p = SA[m - 1]; c1 = T[p];
                do
                {
                    q = B[c0 = c1];
                    while (q < j)
                    {
                        SA[--j] = 0;
                    }
                    do
                    {
                        SA[--j] = p;
                        if (--i < 0)
                        {
                            break;
                        }
                        p = SA[i];
                    } while ((c1 = T[p]) == c0);
                } while (0 <= i);
                while (0 < j)
                {
                    SA[--j] = 0;
                }
            }
            if (isbwt == false)
            {
                induceSA(T, SA, C, B, n, k);
            }
            else
            {
                pidx = computeBWT(T, SA, C, B, n, k);
            }
            C = null; B = null;
            return(SA);
        }
Exemple #37
0
    sais_main(BaseArray T, int[] SA, int fs, int n, int k, bool isbwt)
    {
      BaseArray C, B, RA;
      int i, j, b, m, p, q, name, pidx = 0, newfs;
      int c0, c1;
      uint flags = 0;

      if (k <= MINBUCKETSIZE)
      {
        C = new IntArray(new int[k], 0);
        if (k <= fs) { B = new IntArray(SA, n + fs - k); flags = 1; }
        else { B = new IntArray(new int[k], 0); flags = 3; }
      }
      else if (k <= fs)
      {
        C = new IntArray(SA, n + fs - k);
        if (k <= (fs - k)) { B = new IntArray(SA, n + fs - k * 2); flags = 0; }
        else if (k <= (MINBUCKETSIZE * 4)) { B = new IntArray(new int[k], 0); flags = 2; }
        else { B = C; flags = 8; }
      }
      else
      {
        C = B = new IntArray(new int[k], 0);
        flags = 4 | 8;
      }

      /* stage 1: reduce the problem by at least 1/2
         sort all the LMS-substrings */
      getCounts(T, C, n, k); getBuckets(C, B, k, true); /* find ends of buckets */
      for (i = 0; i < n; ++i) { SA[i] = 0; }
      b = -1; i = n - 1; j = n; m = 0; c0 = T[n - 1];
      do { c1 = c0; } while ((0 <= --i) && ((c0 = T[i]) >= c1));
      for (; 0 <= i; )
      {
        do { c1 = c0; } while ((0 <= --i) && ((c0 = T[i]) <= c1));
        if (0 <= i)
        {
          if (0 <= b) { SA[b] = j; } b = --B[c1]; j = i; ++m;
          do { c1 = c0; } while ((0 <= --i) && ((c0 = T[i]) >= c1));
        }
      }
      if (1 < m)
      {
        LMSsort(T, SA, C, B, n, k);
        name = LMSpostproc(T, SA, n, m);
      }
      else if (m == 1)
      {
        SA[b] = j + 1;
        name = 1;
      }
      else
      {
        name = 0;
      }

      /* stage 2: solve the reduced problem
         recurse if names are not yet unique */
      if (name < m)
      {
        if ((flags & 4) != 0) { C = null; B = null; }
        if ((flags & 2) != 0) { B = null; }
        newfs = (n + fs) - (m * 2);
        if ((flags & (1 | 4 | 8)) == 0)
        {
          if ((k + name) <= newfs) { newfs -= k; }
          else { flags |= 8; }
        }
        for (i = m + (n >> 1) - 1, j = m * 2 + newfs - 1; m <= i; --i)
        {
          if (SA[i] != 0) { SA[j--] = SA[i] - 1; }
        }
        RA = new IntArray(SA, m + newfs);
        sais_main(RA, SA, newfs, m, name, false);
        RA = null;

        i = n - 1; j = m * 2 - 1; c0 = T[n - 1];
        do { c1 = c0; } while ((0 <= --i) && ((c0 = T[i]) >= c1));
        for (; 0 <= i; )
        {
          do { c1 = c0; } while ((0 <= --i) && ((c0 = T[i]) <= c1));
          if (0 <= i)
          {
            SA[j--] = i + 1;
            do { c1 = c0; } while ((0 <= --i) && ((c0 = T[i]) >= c1));
          }
        }

        for (i = 0; i < m; ++i) { SA[i] = SA[m + SA[i]]; }
        if ((flags & 4) != 0) { C = B = new IntArray(new int[k], 0); }
        if ((flags & 2) != 0) { B = new IntArray(new int[k], 0); }
      }

      /* stage 3: induce the result for the original problem */
      if ((flags & 8) != 0) { getCounts(T, C, n, k); }
      /* put all left-most S characters into their buckets */
      if (1 < m)
      {
        getBuckets(C, B, k, true); /* find ends of buckets */
        i = m - 1; j = n; p = SA[m - 1]; c1 = T[p];
        do
        {
          q = B[c0 = c1];
          while (q < j) { SA[--j] = 0; }
          do
          {
            SA[--j] = p;
            if (--i < 0) { break; }
            p = SA[i];
          } while ((c1 = T[p]) == c0);
        } while (0 <= i);
        while (0 < j) { SA[--j] = 0; }
      }
      if (isbwt == false) { induceSA(T, SA, C, B, n, k); }
      else { pidx = computeBWT(T, SA, C, B, n, k); }
      C = null; B = null;
      return pidx;
    }
Exemple #38
0
 internal EntryCollection(BaseArray <TArrayType, TArray> array)
 {
     raw = array;
 }
 public void ResetTest()
 {
     var target = new BaseArray<int>();
     target.Reset();
     Assert.AreEqual(0, target.Count());
 }
Exemple #40
0
 internal EntryIterator(BaseArray <TArrayType, TArray> array)
 {
     raw      = array._entries.GetEnumerator();
     raw_data = array;
 }
Exemple #41
0
 LMSsort(BaseArray T, int[] SA, BaseArray C, BaseArray B, int n, int k)
 {
   int b, i, j;
   int c0, c1;
   /* compute SAl */
   if (C == B) { getCounts(T, C, n, k); }
   getBuckets(C, B, k, false); /* find starts of buckets */
   j = n - 1;
   b = B[c1 = T[j]];
   --j;
   SA[b++] = (T[j] < c1) ? ~j : j;
   for (i = 0; i < n; ++i)
   {
     if (0 < (j = SA[i]))
     {
       if ((c0 = T[j]) != c1) { B[c1] = b; b = B[c1 = c0]; }
       --j;
       SA[b++] = (T[j] < c1) ? ~j : j;
       SA[i] = 0;
     }
     else if (j < 0)
     {
       SA[i] = ~j;
     }
   }
   /* compute SAs */
   if (C == B) { getCounts(T, C, n, k); }
   getBuckets(C, B, k, true); /* find ends of buckets */
   for (i = n - 1, b = B[c1 = 0]; 0 <= i; --i)
   {
     if (0 < (j = SA[i]))
     {
       if ((c0 = T[j]) != c1) { B[c1] = b; b = B[c1 = c0]; }
       --j;
       SA[--b] = (T[j] > c1) ? ~(j + 1) : j;
       SA[i] = 0;
     }
   }
 }
Exemple #42
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (Visible != null)
         {
             hashCode = hashCode * 59 + Visible.GetHashCode();
         }
         if (ShowLegend != null)
         {
             hashCode = hashCode * 59 + ShowLegend.GetHashCode();
         }
         if (LegendGroup != null)
         {
             hashCode = hashCode * 59 + LegendGroup.GetHashCode();
         }
         if (Opacity != null)
         {
             hashCode = hashCode * 59 + Opacity.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (UId != null)
         {
             hashCode = hashCode * 59 + UId.GetHashCode();
         }
         if (Ids != null)
         {
             hashCode = hashCode * 59 + Ids.GetHashCode();
         }
         if (CustomData != null)
         {
             hashCode = hashCode * 59 + CustomData.GetHashCode();
         }
         if (Meta != null)
         {
             hashCode = hashCode * 59 + Meta.GetHashCode();
         }
         if (MetaArray != null)
         {
             hashCode = hashCode * 59 + MetaArray.GetHashCode();
         }
         if (SelectedPoints != null)
         {
             hashCode = hashCode * 59 + SelectedPoints.GetHashCode();
         }
         if (HoverLabel != null)
         {
             hashCode = hashCode * 59 + HoverLabel.GetHashCode();
         }
         if (Stream != null)
         {
             hashCode = hashCode * 59 + Stream.GetHashCode();
         }
         if (Transforms != null)
         {
             hashCode = hashCode * 59 + Transforms.GetHashCode();
         }
         if (UiRevision != null)
         {
             hashCode = hashCode * 59 + UiRevision.GetHashCode();
         }
         if (R != null)
         {
             hashCode = hashCode * 59 + R.GetHashCode();
         }
         if (Theta != null)
         {
             hashCode = hashCode * 59 + Theta.GetHashCode();
         }
         if (R0 != null)
         {
             hashCode = hashCode * 59 + R0.GetHashCode();
         }
         if (Dr != null)
         {
             hashCode = hashCode * 59 + Dr.GetHashCode();
         }
         if (Theta0 != null)
         {
             hashCode = hashCode * 59 + Theta0.GetHashCode();
         }
         if (DTheta != null)
         {
             hashCode = hashCode * 59 + DTheta.GetHashCode();
         }
         if (ThetaUnit != null)
         {
             hashCode = hashCode * 59 + ThetaUnit.GetHashCode();
         }
         if (Base != null)
         {
             hashCode = hashCode * 59 + Base.GetHashCode();
         }
         if (BaseArray != null)
         {
             hashCode = hashCode * 59 + BaseArray.GetHashCode();
         }
         if (Offset != null)
         {
             hashCode = hashCode * 59 + Offset.GetHashCode();
         }
         if (OffsetArray != null)
         {
             hashCode = hashCode * 59 + OffsetArray.GetHashCode();
         }
         if (Width != null)
         {
             hashCode = hashCode * 59 + Width.GetHashCode();
         }
         if (WidthArray != null)
         {
             hashCode = hashCode * 59 + WidthArray.GetHashCode();
         }
         if (Text != null)
         {
             hashCode = hashCode * 59 + Text.GetHashCode();
         }
         if (TextArray != null)
         {
             hashCode = hashCode * 59 + TextArray.GetHashCode();
         }
         if (HoverText != null)
         {
             hashCode = hashCode * 59 + HoverText.GetHashCode();
         }
         if (HoverTextArray != null)
         {
             hashCode = hashCode * 59 + HoverTextArray.GetHashCode();
         }
         if (Marker != null)
         {
             hashCode = hashCode * 59 + Marker.GetHashCode();
         }
         if (HoverInfo != null)
         {
             hashCode = hashCode * 59 + HoverInfo.GetHashCode();
         }
         if (HoverInfoArray != null)
         {
             hashCode = hashCode * 59 + HoverInfoArray.GetHashCode();
         }
         if (HoverTemplate != null)
         {
             hashCode = hashCode * 59 + HoverTemplate.GetHashCode();
         }
         if (HoverTemplateArray != null)
         {
             hashCode = hashCode * 59 + HoverTemplateArray.GetHashCode();
         }
         if (Selected != null)
         {
             hashCode = hashCode * 59 + Selected.GetHashCode();
         }
         if (Unselected != null)
         {
             hashCode = hashCode * 59 + Unselected.GetHashCode();
         }
         if (Subplot != null)
         {
             hashCode = hashCode * 59 + Subplot.GetHashCode();
         }
         if (IdsSrc != null)
         {
             hashCode = hashCode * 59 + IdsSrc.GetHashCode();
         }
         if (CustomDataSrc != null)
         {
             hashCode = hashCode * 59 + CustomDataSrc.GetHashCode();
         }
         if (MetaSrc != null)
         {
             hashCode = hashCode * 59 + MetaSrc.GetHashCode();
         }
         if (RSrc != null)
         {
             hashCode = hashCode * 59 + RSrc.GetHashCode();
         }
         if (ThetaSrc != null)
         {
             hashCode = hashCode * 59 + ThetaSrc.GetHashCode();
         }
         if (BaseSrc != null)
         {
             hashCode = hashCode * 59 + BaseSrc.GetHashCode();
         }
         if (OffsetSrc != null)
         {
             hashCode = hashCode * 59 + OffsetSrc.GetHashCode();
         }
         if (WidthSrc != null)
         {
             hashCode = hashCode * 59 + WidthSrc.GetHashCode();
         }
         if (TextSrc != null)
         {
             hashCode = hashCode * 59 + TextSrc.GetHashCode();
         }
         if (HoverTextSrc != null)
         {
             hashCode = hashCode * 59 + HoverTextSrc.GetHashCode();
         }
         if (HoverInfoSrc != null)
         {
             hashCode = hashCode * 59 + HoverInfoSrc.GetHashCode();
         }
         if (HoverTemplateSrc != null)
         {
             hashCode = hashCode * 59 + HoverTemplateSrc.GetHashCode();
         }
         return(hashCode);
     }
 }
        LMSpostproc(BaseArray T, LongArray SA, long n, long m)
        {
            long i, j, p, q, plen, qlen, name;
            long c0, c1;
            bool diff;

            /* compact all the sorted substrings into the first m items of SA
             *  2*m must be not larger than n (proveable) */
            for (i = 0; (p = SA[i]) < 0; ++i)
            {
                SA[i] = ~p;
            }
            if (i < m)
            {
                for (j = i, ++i; ; ++i)
                {
                    if ((p = SA[i]) < 0)
                    {
                        SA[j++] = ~p; SA[i] = 0;
                        if (j == m)
                        {
                            break;
                        }
                    }
                }
            }

            /* store the length of all substrings */
            i = n - 1; j = n - 1; c0 = T[n - 1];
            do
            {
                c1 = c0;
            } while ((0 <= --i) && ((c0 = T[i]) >= c1));
            for (; 0 <= i;)
            {
                do
                {
                    c1 = c0;
                } while ((0 <= --i) && ((c0 = T[i]) <= c1));
                if (0 <= i)
                {
                    SA[m + ((i + 1) >> 1)] = j - i; j = i + 1;
                    do
                    {
                        c1 = c0;
                    } while ((0 <= --i) && ((c0 = T[i]) >= c1));
                }
            }

            /* find the lexicographic names of all substrings */
            for (i = 0, name = 0, q = n, qlen = 0; i < m; ++i)
            {
                p = SA[i]; plen = SA[m + (p >> 1)]; diff = true;
                if ((plen == qlen) && ((q + plen) < n))
                {
                    for (j = 0; (j < plen) && (T[p + j] == T[q + j]); ++j)
                    {
                    }
                    if (j == plen)
                    {
                        diff = false;
                    }
                }
                if (diff != false)
                {
                    ++name; q = p; qlen = plen;
                }
                SA[m + (p >> 1)] = name;
            }

            return(name);
        }