Пример #1
0
 public void Clear()
 {
     this.Values = new Cube <S, Cube <T, Cube <U, Cube <V, Cube <W, Cube <X, Cube <Y, Cube <Z, VALUE> > > > > > > >();
 }
Пример #2
0
 public void Dispose()
 {
     this.Values = null;
 }
Пример #3
0
 public void Clear()
 {
     this.Values = new Cube <X, Cube <Y, Cube <Z, VALUE> > >(this.UnderlyingHashType);
 }
Пример #4
0
        public void Upsert(bool replaceExistingData, S s, T t, U u, V v, W w, X x, Y y, Z z, VALUE d)
        {
            Cube <T, Cube <U, Cube <V, Cube <W, Cube <X, Cube <Y, Cube <Z, VALUE> > > > > > > ts = null;
            Cube <U, Cube <V, Cube <W, Cube <X, Cube <Y, Cube <Z, VALUE> > > > > >            us = null;
            Cube <V, Cube <W, Cube <X, Cube <Y, Cube <Z, VALUE> > > > > vs = null;
            Cube <W, Cube <X, Cube <Y, Cube <Z, VALUE> > > >            ws = null;
            Cube <X, Cube <Y, Cube <Z, VALUE> > > xs = null;
            Cube <Y, Cube <Z, VALUE> >            ys = null;
            Cube <Z, VALUE> zs = null;

            int level = 0;

            if (this.Values.TryGetValue(s, out ts))
            {
                if (ts.TryGetValue(t, out us))
                {
                    if (us.TryGetValue(u, out vs))
                    {
                        if (vs.TryGetValue(v, out ws))
                        {
                            if (ws.TryGetValue(w, out xs))
                            {
                                if (xs.TryGetValue(x, out ys))
                                {
                                    if (ys.TryGetValue(y, out zs))
                                    {
                                        if (zs.ContainsKey(z))
                                        {
                                            if (replaceExistingData)
                                            {
                                                zs[z] = d;
                                                return;
                                            }
                                        }
                                        else
                                        {
                                            level = 8;
                                        }
                                    }
                                    else
                                    {
                                        level = 7;
                                    }
                                }
                                else
                                {
                                    level = 6;
                                }
                            }
                            else
                            {
                                level = 5;
                            }
                        }
                        else
                        {
                            level = 4;
                        }
                    }
                    else
                    {
                        level = 3;
                    }
                }
                else
                {
                    level = 2;
                }
            }
            else
            {
                level = 1;
            }

            if (level == 1)
            {
                ts = new Cube <T, Cube <U, Cube <V, Cube <W, Cube <X, Cube <Y, Cube <Z, VALUE> > > > > > >(); this.Values.Add(s, ts); level++;
            }
            if (level == 2)
            {
                us = new Cube <U, Cube <V, Cube <W, Cube <X, Cube <Y, Cube <Z, VALUE> > > > > >(); ts?.Add(t, us); level++;
            }
            if (level == 3)
            {
                vs = new Cube <V, Cube <W, Cube <X, Cube <Y, Cube <Z, VALUE> > > > >(); us?.Add(u, vs); level++;
            }
            if (level == 4)
            {
                ws = new Cube <W, Cube <X, Cube <Y, Cube <Z, VALUE> > > >(); vs?.Add(v, ws); level++;
            }
            if (level == 5)
            {
                xs = new Cube <X, Cube <Y, Cube <Z, VALUE> > >(); ws?.Add(w, xs); level++;
            }
            if (level == 6)
            {
                ys = new Cube <Y, Cube <Z, VALUE> >(); xs?.Add(x, ys); level++;
            }
            if (level == 7)
            {
                zs = new Cube <Z, VALUE>(); ys?.Add(y, zs); level++;
            }
            if (level == 8)
            {
                zs?.Add(z, d);
            }
        }
Пример #5
0
        public void Upsert(bool replaceExistingData, V v, W w, X x, Y y, Z z, VALUE d)
        {
            int level = 0;

            Cube <W, Cube <X, Cube <Y, Cube <Z, VALUE> > > > ws = null;
            Cube <X, Cube <Y, Cube <Z, VALUE> > >            xs = null;
            Cube <Y, Cube <Z, VALUE> > ys = null;
            Cube <Z, VALUE>            zs = null;

            if (this.Values.TryGetValue(v, out ws))
            {
                if (ws.TryGetValue(w, out xs))
                {
                    if (xs.TryGetValue(x, out ys))
                    {
                        if (ys.TryGetValue(y, out zs))
                        {
                            if (zs.ContainsKey(z))
                            {
                                if (replaceExistingData)
                                {
                                    zs[z] = d;
                                    return;
                                }
                            }
                            else
                            {
                                level = 5;
                            }
                        }
                        else
                        {
                            level = 4;
                        }
                    }
                    else
                    {
                        level = 3;
                    }
                }
                else
                {
                    level = 2;
                }
            }
            else
            {
                level = 1;
            }

            if (level == 1)
            {
                ws = new Cube <W, Cube <X, Cube <Y, Cube <Z, VALUE> > > >(); this.Values.Add(v, ws); level++;
            }
            if (level == 2)
            {
                xs = new Cube <X, Cube <Y, Cube <Z, VALUE> > >(); ws?.Add(w, xs); level++;
            }
            if (level == 3)
            {
                ys = new Cube <Y, Cube <Z, VALUE> >(); xs?.Add(x, ys); level++;
            }
            if (level == 4)
            {
                zs = new Cube <Z, VALUE>(); ys?.Add(y, zs); level++;
            }
            if (level == 5)
            {
                zs?.Add(z, d);
            }
        }