Ejemplo n.º 1
0
 /// <summary>Returns a new instance of this object with any number of properties changed.</summary>
 private Fruit WithFactory(
     ImmutableObjectGraph.Optional <System.String> color        = default(ImmutableObjectGraph.Optional <System.String>),
     ImmutableObjectGraph.Optional <System.Int32> skinThickness = default(ImmutableObjectGraph.Optional <System.Int32>),
     ImmutableObjectGraph.Optional <System.UInt32> identity     = default(ImmutableObjectGraph.Optional <System.UInt32>))
 {
     if (
         (identity.IsDefined && identity.Value != this.Identity) ||
         (color.IsDefined && color.Value != this.Color) ||
         (skinThickness.IsDefined && skinThickness.Value != this.SkinThickness))
     {
         return(new Fruit(
                    identity: identity.GetValueOrDefault(this.Identity),
                    color: color.GetValueOrDefault(this.Color),
                    skinThickness: skinThickness.GetValueOrDefault(this.SkinThickness)));
     }
     else
     {
         return(this);
     }
 }
Ejemplo n.º 2
0
        public virtual C1 ToC1(
            ImmutableObjectGraph.Optional <System.Int32> field2 = default(ImmutableObjectGraph.Optional <System.Int32>),
            ImmutableObjectGraph.Optional <System.Int32> field3 = default(ImmutableObjectGraph.Optional <System.Int32>))
        {
            C1 that = this as C1;

            if (that != null && this.GetType().IsEquivalentTo(typeof(C1)))
            {
                if ((!field2.IsDefined || field2.Value == that.Field2) &&
                    (!field3.IsDefined || field3.Value == that.Field3))
                {
                    return(that);
                }
            }

            return(C1.Create(
                       field1: this.Field1,
                       field2: field2,
                       field3: field3));
        }
        public virtual XmlElement ToXmlElement(
            ImmutableObjectGraph.Optional <System.String> namespaceName = default(ImmutableObjectGraph.Optional <System.String>),
            ImmutableObjectGraph.Optional <System.Collections.Immutable.ImmutableList <XmlNode> > children = default(ImmutableObjectGraph.Optional <System.Collections.Immutable.ImmutableList <XmlNode> >))
        {
            XmlElement that = this as XmlElement;

            if (that != null && this.GetType().IsEquivalentTo(typeof(XmlElement)))
            {
                if ((!namespaceName.IsDefined || namespaceName.Value == that.NamespaceName) &&
                    (!children.IsDefined || children.Value == that.Children))
                {
                    return(that);
                }
            }

            return(XmlElement.Create(
                       localName: this.LocalName,
                       namespaceName: namespaceName,
                       children: children));
        }
 /// <summary>Returns a new instance of this object with any number of properties changed.</summary>
 public virtual XmlAttribute With(
     ImmutableObjectGraph.Optional <System.String> localName     = default(ImmutableObjectGraph.Optional <System.String>),
     ImmutableObjectGraph.Optional <System.String> namespaceName = default(ImmutableObjectGraph.Optional <System.String>),
     ImmutableObjectGraph.Optional <System.String> value         = default(ImmutableObjectGraph.Optional <System.String>))
 {
     if (
         (localName.IsDefined && localName.Value != this.LocalName) ||
         (namespaceName.IsDefined && namespaceName.Value != this.NamespaceName) ||
         (value.IsDefined && value.Value != this.Value))
     {
         return(new XmlAttribute(
                    localName: localName.GetValueOrDefault(this.LocalName),
                    namespaceName: namespaceName.GetValueOrDefault(this.NamespaceName),
                    value: value.GetValueOrDefault(this.Value)));
     }
     else
     {
         return(this);
     }
 }
 /// <summary>Returns a new instance of this object with any number of properties changed.</summary>
 public virtual XmlElement With(
     ImmutableObjectGraph.Optional <System.String> localName     = default(ImmutableObjectGraph.Optional <System.String>),
     ImmutableObjectGraph.Optional <System.String> namespaceName = default(ImmutableObjectGraph.Optional <System.String>),
     ImmutableObjectGraph.Optional <System.Collections.Immutable.ImmutableList <XmlNode> > children = default(ImmutableObjectGraph.Optional <System.Collections.Immutable.ImmutableList <XmlNode> >))
 {
     if (
         (localName.IsDefined && localName.Value != this.LocalName) ||
         (namespaceName.IsDefined && namespaceName.Value != this.NamespaceName) ||
         (children.IsDefined && children.Value != this.Children))
     {
         return(new XmlElement(
                    localName: localName.GetValueOrDefault(this.LocalName),
                    namespaceName: namespaceName.GetValueOrDefault(this.NamespaceName),
                    children: children.GetValueOrDefault(this.Children)));
     }
     else
     {
         return(this);
     }
 }
        public virtual XmlAttribute ToXmlAttribute(
            ImmutableObjectGraph.Optional <System.String> namespaceName = default(ImmutableObjectGraph.Optional <System.String>),
            ImmutableObjectGraph.Optional <System.String> value         = default(ImmutableObjectGraph.Optional <System.String>))
        {
            XmlAttribute that = this as XmlAttribute;

            if (that != null && this.GetType().IsEquivalentTo(typeof(XmlAttribute)))
            {
                if ((!namespaceName.IsDefined || namespaceName.Value == that.NamespaceName) &&
                    (!value.IsDefined || value.Value == that.Value))
                {
                    return(that);
                }
            }

            return(XmlAttribute.Create(
                       localName: this.LocalName,
                       namespaceName: namespaceName,
                       value: value));
        }
Ejemplo n.º 7
0
 /// <summary>Returns a new instance of this object with any number of properties changed.</summary>
 private Contact WithFactory(
     ImmutableObjectGraph.Optional <System.String> name     = default(ImmutableObjectGraph.Optional <System.String>),
     ImmutableObjectGraph.Optional <System.String> email    = default(ImmutableObjectGraph.Optional <System.String>),
     ImmutableObjectGraph.Optional <System.UInt32> identity = default(ImmutableObjectGraph.Optional <System.UInt32>))
 {
     if (
         (identity.IsDefined && identity.Value != this.Identity) ||
         (name.IsDefined && name.Value != this.Name) ||
         (email.IsDefined && email.Value != this.Email))
     {
         return(new Contact(
                    identity: identity.GetValueOrDefault(this.Identity),
                    name: name.GetValueOrDefault(this.Name),
                    email: email.GetValueOrDefault(this.Email)));
     }
     else
     {
         return(this);
     }
 }
Ejemplo n.º 8
0
 /// <summary>Returns a new instance of this object with any number of properties changed.</summary>
 private NonRecursiveElement WithFactory(
     ImmutableObjectGraph.Optional <System.String> name     = default(ImmutableObjectGraph.Optional <System.String>),
     ImmutableObjectGraph.Optional <System.String> value    = default(ImmutableObjectGraph.Optional <System.String>),
     ImmutableObjectGraph.Optional <System.UInt32> identity = default(ImmutableObjectGraph.Optional <System.UInt32>))
 {
     if (
         (identity.IsDefined && identity.Value != this.Identity) ||
         (name.IsDefined && name.Value != this.Name) ||
         (value.IsDefined && value.Value != this.Value))
     {
         return(new NonRecursiveElement(
                    identity: identity.GetValueOrDefault(this.Identity),
                    name: name.GetValueOrDefault(this.Name),
                    value: value.GetValueOrDefault(this.Value)));
     }
     else
     {
         return(this);
     }
 }
Ejemplo n.º 9
0
        public virtual NonRecursiveElement ToNonRecursiveElement(
            ImmutableObjectGraph.Optional <System.String> name  = default(ImmutableObjectGraph.Optional <System.String>),
            ImmutableObjectGraph.Optional <System.String> value = default(ImmutableObjectGraph.Optional <System.String>))
        {
            NonRecursiveElement that = this as NonRecursiveElement;

            if (that != null && this.GetType().IsEquivalentTo(typeof(NonRecursiveElement)))
            {
                if ((!name.IsDefined || name.Value == that.Name) &&
                    (!value.IsDefined || value.Value == that.Value))
                {
                    return(that);
                }
            }

            return(NonRecursiveElement.CreateWithIdentity(
                       identity: this.Identity,
                       name: name,
                       value: value));
        }
Ejemplo n.º 10
0
 /// <summary>Returns a new instance of this object with any number of properties changed.</summary>
 public virtual Person With(
     ImmutableObjectGraph.Optional <System.String> name = default(ImmutableObjectGraph.Optional <System.String>),
     ImmutableObjectGraph.Optional <System.Int32> age   = default(ImmutableObjectGraph.Optional <System.Int32>),
     ImmutableObjectGraph.Optional <Watch> watch        = default(ImmutableObjectGraph.Optional <Watch>))
 {
     if (
         (name.IsDefined && name.Value != this.Name) ||
         (age.IsDefined && age.Value != this.Age) ||
         (watch.IsDefined && watch.Value != this.Watch))
     {
         return(new Person(
                    name: name.GetValueOrDefault(this.Name),
                    age: age.GetValueOrDefault(this.Age),
                    watch: watch.GetValueOrDefault(this.Watch)));
     }
     else
     {
         return(this);
     }
 }
 /// <summary>Returns a new instance of this object with any number of properties changed.</summary>
 private B WithFactory(
     ImmutableObjectGraph.Optional <System.Int32> field1    = default(ImmutableObjectGraph.Optional <System.Int32>),
     ImmutableObjectGraph.Optional <System.Int32> field2    = default(ImmutableObjectGraph.Optional <System.Int32>),
     ImmutableObjectGraph.Optional <System.UInt32> identity = default(ImmutableObjectGraph.Optional <System.UInt32>))
 {
     if (
         (identity.IsDefined && identity.Value != this.Identity) ||
         (field1.IsDefined && field1.Value != this.Field1) ||
         (field2.IsDefined && field2.Value != this.Field2))
     {
         return(new B(
                    identity: identity.GetValueOrDefault(this.Identity),
                    field1: field1.GetValueOrDefault(this.Field1),
                    field2: field2.GetValueOrDefault(this.Field2)));
     }
     else
     {
         return(this);
     }
 }
Ejemplo n.º 12
0
 /// <summary>Returns a new instance of this object with any number of properties changed.</summary>
 private Watch WithFactory(
     ImmutableObjectGraph.Optional <System.String> color    = default(ImmutableObjectGraph.Optional <System.String>),
     ImmutableObjectGraph.Optional <System.Int32> size      = default(ImmutableObjectGraph.Optional <System.Int32>),
     ImmutableObjectGraph.Optional <System.UInt32> identity = default(ImmutableObjectGraph.Optional <System.UInt32>))
 {
     if (
         (identity.IsDefined && identity.Value != this.Identity) ||
         (color.IsDefined && color.Value != this.Color) ||
         (size.IsDefined && size.Value != this.Size))
     {
         return(new Watch(
                    identity: identity.GetValueOrDefault(this.Identity),
                    color: color.GetValueOrDefault(this.Color),
                    size: size.GetValueOrDefault(this.Size)));
     }
     else
     {
         return(this);
     }
 }
        public virtual ReqAndHierL2 ToReqAndHierL2(
            System.String l2Field2,
            ImmutableObjectGraph.Optional <System.String> l2Field1 = default(ImmutableObjectGraph.Optional <System.String>))
        {
            ReqAndHierL2 that = this as ReqAndHierL2;

            if (that != null && this.GetType().IsEquivalentTo(typeof(ReqAndHierL2)))
            {
                if ((!l2Field1.IsDefined || l2Field1.Value == that.L2Field1) &&
                    (l2Field2 == that.L2Field2))
                {
                    return(that);
                }
            }

            return(ReqAndHierL2.Create(
                       l1Field1: this.L1Field1,
                       l1Field2: this.L1Field2,
                       l2Field1: l2Field1,
                       l2Field2: l2Field2));
        }
        public virtual C2 ToC2(
            ImmutableObjectGraph.Optional <System.Int32> field2 = default(ImmutableObjectGraph.Optional <System.Int32>),
            ImmutableObjectGraph.Optional <System.Int32> field3 = default(ImmutableObjectGraph.Optional <System.Int32>))
        {
            C2 that = this as C2;

            if (that != null && this.GetType().IsEquivalentTo(typeof(C2)))
            {
                if ((!field2.IsDefined || field2.Value == that.Field2) &&
                    (!field3.IsDefined || field3.Value == that.Field3))
                {
                    return(that);
                }
            }

            return(C2.CreateWithIdentity(
                       field1: Optional.For(this.Field1),
                       identity: this.Identity,
                       field2: field2,
                       field3: field3));
        }
        internal static ConcreteOf2Abstracts CreateWithIdentity(
            ImmutableObjectGraph.Optional <System.Int32> abstract1Field1 = default(ImmutableObjectGraph.Optional <System.Int32>),
            ImmutableObjectGraph.Optional <System.Int32> abstract1Field2 = default(ImmutableObjectGraph.Optional <System.Int32>),
            ImmutableObjectGraph.Optional <System.Int32> abstract2Field1 = default(ImmutableObjectGraph.Optional <System.Int32>),
            ImmutableObjectGraph.Optional <System.Int32> abstract2Field2 = default(ImmutableObjectGraph.Optional <System.Int32>),
            ImmutableObjectGraph.Optional <System.Int32> concreteField1  = default(ImmutableObjectGraph.Optional <System.Int32>),
            ImmutableObjectGraph.Optional <System.Int32> concreteField2  = default(ImmutableObjectGraph.Optional <System.Int32>),
            ImmutableObjectGraph.Optional <System.UInt32> identity       = default(ImmutableObjectGraph.Optional <System.UInt32>))
        {
            if (!identity.IsDefined)
            {
                identity = NewIdentity();
            }

            return(DefaultInstance.WithFactory(
                       abstract1Field1: Optional.For(abstract1Field1.GetValueOrDefault(DefaultInstance.Abstract1Field1)),
                       abstract1Field2: Optional.For(abstract1Field2.GetValueOrDefault(DefaultInstance.Abstract1Field2)),
                       abstract2Field1: Optional.For(abstract2Field1.GetValueOrDefault(DefaultInstance.Abstract2Field1)),
                       abstract2Field2: Optional.For(abstract2Field2.GetValueOrDefault(DefaultInstance.Abstract2Field2)),
                       concreteField1: Optional.For(concreteField1.GetValueOrDefault(DefaultInstance.ConcreteField1)),
                       concreteField2: Optional.For(concreteField2.GetValueOrDefault(DefaultInstance.ConcreteField2)),
                       identity: Optional.For(identity.GetValueOrDefault(DefaultInstance.Identity))));
        }
Ejemplo n.º 16
0
 /// <summary>Returns a new instance of this object with any number of properties changed.</summary>
 private Person WithFactory(
     ImmutableObjectGraph.Optional <System.String> name     = default(ImmutableObjectGraph.Optional <System.String>),
     ImmutableObjectGraph.Optional <System.Int32> age       = default(ImmutableObjectGraph.Optional <System.Int32>),
     ImmutableObjectGraph.Optional <Watch> watch            = default(ImmutableObjectGraph.Optional <Watch>),
     ImmutableObjectGraph.Optional <System.UInt32> identity = default(ImmutableObjectGraph.Optional <System.UInt32>))
 {
     if (
         (identity.IsDefined && identity.Value != this.Identity) ||
         (name.IsDefined && name.Value != this.Name) ||
         (age.IsDefined && age.Value != this.Age) ||
         (watch.IsDefined && watch.Value != this.Watch))
     {
         return(new Person(
                    identity: identity.GetValueOrDefault(this.Identity),
                    name: name.GetValueOrDefault(this.Name),
                    age: age.GetValueOrDefault(this.Age),
                    watch: watch.GetValueOrDefault(this.Watch)));
     }
     else
     {
         return(this);
     }
 }
 /// <summary>Returns a new instance of this object with any number of properties changed.</summary>
 public virtual ReqAndHierL2 With(
     ImmutableObjectGraph.Optional <System.String> l1Field1 = default(ImmutableObjectGraph.Optional <System.String>),
     ImmutableObjectGraph.Optional <System.String> l1Field2 = default(ImmutableObjectGraph.Optional <System.String>),
     ImmutableObjectGraph.Optional <System.String> l2Field1 = default(ImmutableObjectGraph.Optional <System.String>),
     ImmutableObjectGraph.Optional <System.String> l2Field2 = default(ImmutableObjectGraph.Optional <System.String>))
 {
     if (
         (l1Field1.IsDefined && l1Field1.Value != this.L1Field1) ||
         (l1Field2.IsDefined && l1Field2.Value != this.L1Field2) ||
         (l2Field1.IsDefined && l2Field1.Value != this.L2Field1) ||
         (l2Field2.IsDefined && l2Field2.Value != this.L2Field2))
     {
         return(new ReqAndHierL2(
                    l1Field1: l1Field1.GetValueOrDefault(this.L1Field1),
                    l1Field2: l1Field2.GetValueOrDefault(this.L1Field2),
                    l2Field1: l2Field1.GetValueOrDefault(this.L2Field1),
                    l2Field2: l2Field2.GetValueOrDefault(this.L2Field2)));
     }
     else
     {
         return(this);
     }
 }
        public virtual ConcreteOf2Abstracts ToConcreteOf2Abstracts(
            ImmutableObjectGraph.Optional <System.Int32> concreteField1 = default(ImmutableObjectGraph.Optional <System.Int32>),
            ImmutableObjectGraph.Optional <System.Int32> concreteField2 = default(ImmutableObjectGraph.Optional <System.Int32>))
        {
            ConcreteOf2Abstracts that = this as ConcreteOf2Abstracts;

            if (that != null && this.GetType().IsEquivalentTo(typeof(ConcreteOf2Abstracts)))
            {
                if ((!concreteField1.IsDefined || concreteField1.Value == that.ConcreteField1) &&
                    (!concreteField2.IsDefined || concreteField2.Value == that.ConcreteField2))
                {
                    return(that);
                }
            }

            return(ConcreteOf2Abstracts.CreateWithIdentity(
                       abstract1Field1: Optional.For(this.Abstract1Field1),
                       abstract1Field2: Optional.For(this.Abstract1Field2),
                       abstract2Field1: Optional.For(this.Abstract2Field1),
                       abstract2Field2: Optional.For(this.Abstract2Field2),
                       identity: this.Identity,
                       concreteField1: concreteField1,
                       concreteField2: concreteField2));
        }
 private CustomerThrottleContext WithFactory(ImmutableObjectGraph.Optional <Banda.AsyncThrottledFunctionExecutor.CustomerThrottle> customerThrottle = default(ImmutableObjectGraph.Optional <Banda.AsyncThrottledFunctionExecutor.CustomerThrottle>), ImmutableObjectGraph.Optional <System.Object> tokenBucket = default(ImmutableObjectGraph.Optional <System.Object>), ImmutableObjectGraph.Optional <uint> identity = default(ImmutableObjectGraph.Optional <uint>))
 {
     if ((identity.IsDefined && identity.Value != this.Identity) || (customerThrottle.IsDefined && customerThrottle.Value != this.CustomerThrottle) || (tokenBucket.IsDefined && tokenBucket.Value != this.TokenBucket))
     {
         return(new CustomerThrottleContext(identity: identity.GetValueOrDefault(this.Identity), customerThrottle: customerThrottle.GetValueOrDefault(this.CustomerThrottle), tokenBucket: tokenBucket.GetValueOrDefault(this.TokenBucket), skipValidation: false));
     }
     else
     {
         return(this);
     }
 }
 public CustomerThrottleContext With(ImmutableObjectGraph.Optional <Banda.AsyncThrottledFunctionExecutor.CustomerThrottle> customerThrottle = default(ImmutableObjectGraph.Optional <Banda.AsyncThrottledFunctionExecutor.CustomerThrottle>), ImmutableObjectGraph.Optional <System.Object> tokenBucket = default(ImmutableObjectGraph.Optional <System.Object>))
 {
     return((CustomerThrottleContext)this.WithCore(customerThrottle: customerThrottle, tokenBucket: tokenBucket));
 }
 protected virtual CustomerThrottleContext WithCore(ImmutableObjectGraph.Optional <Banda.AsyncThrottledFunctionExecutor.CustomerThrottle> customerThrottle = default(ImmutableObjectGraph.Optional <Banda.AsyncThrottledFunctionExecutor.CustomerThrottle>), ImmutableObjectGraph.Optional <System.Object> tokenBucket = default(ImmutableObjectGraph.Optional <System.Object>))
 {
     return(this.WithFactory(customerThrottle: customerThrottle, tokenBucket: tokenBucket, identity: ImmutableObjectGraph.Optional.For(this.Identity)));
 }
Ejemplo n.º 22
0
 /// <summary>Returns a new instance of this object with any number of properties changed.</summary>
 public abstract FileSystemEntry With(
     ImmutableObjectGraph.Optional <System.String> pathSegment = default(ImmutableObjectGraph.Optional <System.String>));
        public static CustomerThrottleContext Create(ImmutableObjectGraph.Optional <Banda.AsyncThrottledFunctionExecutor.CustomerThrottle> customerThrottle = default(ImmutableObjectGraph.Optional <Banda.AsyncThrottledFunctionExecutor.CustomerThrottle>), ImmutableObjectGraph.Optional <System.Object> tokenBucket = default(ImmutableObjectGraph.Optional <System.Object>))
        {
            var identity = ImmutableObjectGraph.Optional.For(NewIdentity());

            return(DefaultInstance.WithFactory(customerThrottle: ImmutableObjectGraph.Optional.For(customerThrottle.GetValueOrDefault(DefaultInstance.CustomerThrottle)), tokenBucket: ImmutableObjectGraph.Optional.For(tokenBucket.GetValueOrDefault(DefaultInstance.TokenBucket)), identity: identity));
        }
Ejemplo n.º 24
0
 public static Family Create(
     ImmutableObjectGraph.Optional <System.Collections.Immutable.ImmutableSortedSet <Person> > members = default(ImmutableObjectGraph.Optional <System.Collections.Immutable.ImmutableSortedSet <Person> >))
 {
     return(DefaultInstance.With(
                members: members.GetValueOrDefault(DefaultInstance.Members)));
 }
Ejemplo n.º 25
0
 public static A Create(
     ImmutableObjectGraph.Optional <System.Int32> field1 = default(ImmutableObjectGraph.Optional <System.Int32>))
 {
     return(DefaultInstance.With(
                field1: field1.GetValueOrDefault(DefaultInstance.Field1)));
 }
 /// <summary>Returns a new instance of this object with any number of properties changed.</summary>
 public EmptyDerivedFromAbstract With(
     ImmutableObjectGraph.Optional <System.Boolean> oneField = default(ImmutableObjectGraph.Optional <System.Boolean>))
 {
     return((EmptyDerivedFromAbstract)this.WithCore(
                oneField: oneField));
 }
 /// <summary>Returns a new instance of this object with any number of properties changed.</summary>
 protected override AbstractNonEmpty WithCore(
     ImmutableObjectGraph.Optional <System.Boolean> oneField = default(ImmutableObjectGraph.Optional <System.Boolean>))
 {
     return(this.WithFactory(
                oneField: oneField));
 }
 /// <summary>Returns a new instance of this object with any number of properties changed.</summary>
 protected abstract AbstractNonEmpty WithCore(
     ImmutableObjectGraph.Optional <System.Boolean> oneField = default(ImmutableObjectGraph.Optional <System.Boolean>));
 /// <summary>Returns a new instance of this object with any number of properties changed.</summary>
 public AbstractNonEmpty With(
     ImmutableObjectGraph.Optional <System.Boolean> oneField = default(ImmutableObjectGraph.Optional <System.Boolean>))
 {
     return((AbstractNonEmpty)this.WithCore(
                oneField: oneField));
 }
 /// <summary>Returns a new instance of this object with any number of properties changed.</summary>
 public NonEmptyBase With(
     ImmutableObjectGraph.Optional <System.Boolean> oneField = default(ImmutableObjectGraph.Optional <System.Boolean>))
 {
     return((NonEmptyBase)this.WithCore(
                oneField: oneField));
 }