예제 #1
0
        public void Upsert(bool replaceExistingData, Y y, Z z, VALUE d)
        {
            int level = 0;

            Cube <Z, VALUE> zs = null;

            if (this.Values.TryGetValue(y, out zs))
            {
                if (zs.ContainsKey(z))
                {
                    if (replaceExistingData)
                    {
                        zs[z] = d;
                        return;
                    }
                }
                else
                {
                    level = 2;
                }
            }
            else
            {
                level = 1;
            }

            if (level == 1)
            {
                zs = new Cube <Z, VALUE>(); this.Values.Add(y, zs); level++;
            }
            if (level == 2)
            {
                zs?.Add(z, d);
            }
        }
예제 #2
0
        public void Upsert(bool replaceData, W w, X x, Y y, Z z, VALUE d)
        {
            int level = 0;

            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(w, out xs))
            {
                if (xs.TryGetValue(x, out ys))
                {
                    if (ys.TryGetValue(y, out zs))
                    {
                        if (zs.ContainsKey(z))
                        {
                            if (replaceData)
                            {
                                zs[z] = d;
                                return;
                            }
                        }
                        else
                        {
                            level = 4;
                        }
                    }
                    else
                    {
                        level = 3;
                    }
                }
                else
                {
                    level = 2;
                }
            }
            else
            {
                level = 1;
            }

            if (level == 1)
            {
                xs = new Cube <X, Cube <Y, Cube <Z, VALUE> > >(); this.Values.Add(w, xs); level++;
            }
            if (level == 2)
            {
                ys = new Cube <Y, Cube <Z, VALUE> >(); xs?.Add(x, ys); level++;
            }
            if (level == 3)
            {
                zs = new Cube <Z, VALUE>(); ys?.Add(y, zs); level++;
            }
            if (level == 4)
            {
                zs?.Add(z, d);
            }
        }
예제 #3
0
        public void Upsert(bool replaceExistingData, X x, Y y, Z z, VALUE d)
        {
            int level = 0;

            Cube <Y, Cube <Z, VALUE> > ys = null;
            Cube <Z, VALUE>            zs = null;

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

            if (level == 1)
            {
                ys = new Cube <Y, Cube <Z, VALUE> >(this.UnderlyingHashType); this.Values.Add(x, ys); level++;
            }
            if (level == 2)
            {
                zs = new Cube <Z, VALUE>(this.UnderlyingHashType); ys?.Add(y, zs); level++;
            }
            if (level == 3)
            {
                zs?.Add(z, d);
            }
        }
예제 #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);
            }
        }