Esempio n. 1
0
        public static RangeRestriction <TNewAddress> map <TOldAddress, TNewAddress>(Func <TOldAddress, TNewAddress> f, RangeRestriction <TOldAddress> _arg1)
        {
            RangeRestriction <TOldAddress> rangeRestriction = _arg1;

            switch (rangeRestriction.Tag)
            {
            case 1:
                return(RangeRestriction <TNewAddress> .NewStart(((RangeRestriction <TOldAddress> .Start)rangeRestriction).item));

            case 2:
                return(RangeRestriction <TNewAddress> .NewEnd(((RangeRestriction <TOldAddress> .End)rangeRestriction).item));

            case 3:
                IRangeRestriction <TOldAddress> c = ((RangeRestriction <TOldAddress> .Custom)rangeRestriction).item;
                return(RangeRestriction <TNewAddress> .NewCustom(new RangeRestriction.map <TNewAddress, TOldAddress>(f, c)));

            default:
                RangeRestriction <TOldAddress> .Fixed @fixed = (RangeRestriction <TOldAddress> .Fixed)rangeRestriction;
                TOldAddress oldAddress1 = @fixed.item1;
                TOldAddress oldAddress2 = @fixed.item2;
                return(RangeRestriction <TNewAddress> .NewFixed(f.Invoke(oldAddress1), f.Invoke(oldAddress2)));
            }
        }