示例#1
0
        public virtual bool Equals(RangeRestriction <TAddress> obj)
        {
            if (this == null)
            {
                return(obj == null);
            }
            if (obj == null || this._tag != obj._tag)
            {
                return(false);
            }
            switch (this.Tag)
            {
            case 1:
                return(((RangeRestriction <TAddress> .Start) this).item == ((RangeRestriction <TAddress> .Start)obj).item);

            case 2:
                return(((RangeRestriction <TAddress> .End) this).item == ((RangeRestriction <TAddress> .End)obj).item);

            case 3:
                return(LanguagePrimitives.HashCompare.GenericEqualityERIntrinsic <IRangeRestriction <TAddress> >((M0)((RangeRestriction <TAddress> .Custom) this).item, (M0)((RangeRestriction <TAddress> .Custom)obj).item));

            default:
                RangeRestriction <TAddress> .Fixed fixed1 = (RangeRestriction <TAddress> .Fixed) this;
                RangeRestriction <TAddress> .Fixed fixed2 = (RangeRestriction <TAddress> .Fixed)obj;
                if (LanguagePrimitives.HashCompare.GenericEqualityERIntrinsic <TAddress>((M0)fixed1.item1, (M0)fixed2.item1))
                {
                    return(LanguagePrimitives.HashCompare.GenericEqualityERIntrinsic <TAddress>((M0)fixed1.item2, (M0)fixed2.item2));
                }
                return(false);
            }
        }
示例#2
0
        public override sealed bool Equals(object obj)
        {
            RangeRestriction <TAddress> rangeRestriction = obj as RangeRestriction <TAddress>;

            if (rangeRestriction != null)
            {
                return(this.Equals(rangeRestriction));
            }
            return(false);
        }
示例#3
0
        public virtual bool Equals(object obj, IEqualityComparer comp)
        {
            if (this == null)
            {
                return(obj == null);
            }
            RangeRestriction <TAddress> rangeRestriction1 = obj as RangeRestriction <TAddress>;

            if (rangeRestriction1 == null)
            {
                return(false);
            }
            RangeRestriction <TAddress> rangeRestriction2 = rangeRestriction1;

            if (this._tag != rangeRestriction2._tag)
            {
                return(false);
            }
            switch (this.Tag)
            {
            case 1:
                return(((RangeRestriction <TAddress> .Start) this).item == ((RangeRestriction <TAddress> .Start)rangeRestriction2).item);

            case 2:
                return(((RangeRestriction <TAddress> .End) this).item == ((RangeRestriction <TAddress> .End)rangeRestriction2).item);

            case 3:
                RangeRestriction <TAddress> .Custom custom1 = (RangeRestriction <TAddress> .Custom) this;
                RangeRestriction <TAddress> .Custom custom2 = (RangeRestriction <TAddress> .Custom)rangeRestriction2;
                return(LanguagePrimitives.HashCompare.GenericEqualityWithComparerIntrinsic <IRangeRestriction <TAddress> >(comp, (M0)custom1.item, (M0)custom2.item));

            default:
                RangeRestriction <TAddress> .Fixed fixed1 = (RangeRestriction <TAddress> .Fixed) this;
                RangeRestriction <TAddress> .Fixed fixed2 = (RangeRestriction <TAddress> .Fixed)rangeRestriction2;
                if (LanguagePrimitives.HashCompare.GenericEqualityWithComparerIntrinsic <TAddress>(comp, (M0)fixed1.item1, (M0)fixed2.item1))
                {
                    return(LanguagePrimitives.HashCompare.GenericEqualityWithComparerIntrinsic <TAddress>(comp, (M0)fixed1.item2, (M0)fixed2.item2));
                }
                return(false);
            }
        }
示例#4
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)));
            }
        }
示例#5
0
        public virtual int GetHashCode(IEqualityComparer comp)
        {
            if (this == null)
            {
                return(0);
            }
            switch (this.Tag)
            {
            case 1:
                RangeRestriction <TAddress> .Start start = (RangeRestriction <TAddress> .Start) this;
                int  num1 = 1;
                int  num2 = -1640531527;
                long num3 = start.item;
                int  num4 = ((int)num3 ^ (int)(num3 >> 32)) + ((num1 << 6) + (num1 >> 2));
                return(num2 + num4);

            case 2:
                RangeRestriction <TAddress> .End end = (RangeRestriction <TAddress> .End) this;
                int  num5 = 2;
                int  num6 = -1640531527;
                long num7 = end.item;
                int  num8 = ((int)num7 ^ (int)(num7 >> 32)) + ((num5 << 6) + (num5 >> 2));
                return(num6 + num8);

            case 3:
                RangeRestriction <TAddress> .Custom custom = (RangeRestriction <TAddress> .Custom) this;
                int num9 = 3;
                return(LanguagePrimitives.HashCompare.GenericHashWithComparerIntrinsic <IRangeRestriction <TAddress> >(comp, (M0)custom.item) + ((num9 << 6) + (num9 >> 2)) - 1640531527);

            default:
                RangeRestriction <TAddress> .Fixed @fixed = (RangeRestriction <TAddress> .Fixed) this;
                int num10 = 0;
                int num11 = LanguagePrimitives.HashCompare.GenericHashWithComparerIntrinsic <TAddress>(comp, (M0)@fixed.item2) + ((num10 << 6) + (num10 >> 2)) - 1640531527;
                return(LanguagePrimitives.HashCompare.GenericHashWithComparerIntrinsic <TAddress>(comp, (M0)@fixed.item1) + ((num11 << 6) + (num11 >> 2)) - 1640531527);
            }
        }
示例#6
0
 public RangeRestriction <a> Select <a>(Func <TAddress, a> f)
 {
     return(RangeRestriction.map <TAddress, a>((FSharpFunc <TAddress, a>) new Address.Select <TAddress, a>(f), this));
 }