Esempio n. 1
0
    public static HMap <A, HMap <B, T> > Remove <A, B, T>(this HMap <A, HMap <B, T> > self, A outerKey, B innerKey)
    {
        var b = self.Find(outerKey);

        if (b.IsSome)
        {
            var bv = b.Value.Remove(innerKey);
            if (bv.Count() == 0)
            {
                return(self.Remove(outerKey));
            }
            else
            {
                return(self.SetItem(outerKey, bv));
            }
        }
        else
        {
            return(self);
        }
    }
Esempio n. 2
0
    public static HMap <A, HMap <B, HMap <C, T> > > Remove <A, B, C, T>(this HMap <A, HMap <B, HMap <C, T> > > self, A aKey, B bKey, C cKey)
    {
        var b = self.Find(aKey);

        if (b.IsSome)
        {
            var c = b.Value.Find(bKey);
            if (c.IsSome)
            {
                var cv = c.Value.Remove(cKey);
                if (cv.Count() == 0)
                {
                    var bv = b.Value.Remove(bKey);
                    if (b.Value.Count() == 0)
                    {
                        return(self.Remove(aKey));
                    }
                    else
                    {
                        return(self.SetItem(aKey, bv));
                    }
                }
                else
                {
                    return(self.SetItem(aKey, b.Value.SetItem(bKey, cv)));
                }
            }
            else
            {
                return(self);
            }
        }
        else
        {
            return(self);
        }
    }