protected override void DefineBindings(IObjectBinder objBinder)
        {
            base.DefineBindings(objBinder);

            var binder = (ObjectBinder <SimulationContext>)objBinder;

            binder.AddOption(sc => sc.Years, "-y")
            .Description("years to simulate")
            .DefaultValue(10)
            .Validator(OptionInRange <int> .GreaterThanEqual(1));

            binder.AddOption(sc => sc.Investments, "-i")
            .Description("investments to simulate")
            .DefaultValue(5)
            .Validator(OptionInRange <int> .GreaterThanEqual(1));

            binder.AddOption(sc => sc.Simulations, "-s")
            .Description("simulations to run")
            .DefaultValue(10)
            .Validator(OptionInRange <int> .GreaterThanEqual(1));

            binder.AddOption(sc => sc.MeanMarketReturn, "-r")
            .Description("mean annual rate of return for the total market")
            .DefaultValue(0.1)
            .Validator(OptionInRange <double> .GreaterThan(0.0));

            binder.AddOption(sc => sc.StdDevMarketReturn, "-d")
            .Description("standard deviation of total market annual rate of return")
            .DefaultValue(0.2)
            .Validator(OptionInRange <double> .GreaterThan(0.0));
        }
Esempio n. 2
0
        private InvWorkPoint(Point point, IObjectBinder binder)
        {
            this.point = point;
            this.binder = binder;

            if (binder.DocumentManager.ActiveAssemblyDoc != null)
            {
                this.binder.ContextManager.BindingContextManager = binder.DocumentManager.ActiveAssemblyDoc.ReferenceKeyManager;
            }
            else if (binder.DocumentManager.ActivePartDoc != null)
            {
                this.binder.ContextManager.BindingContextManager = binder.DocumentManager.ActivePartDoc.ReferenceKeyManager;
            }
            this.binder.ContextManager.BindingContextManager = binder.DocumentManager.ActiveAssemblyDoc.ReferenceKeyManager;
            Inventor.WorkPoint wp;
            if (this.binder.GetObjectFromTrace<Inventor.WorkPoint>(out wp))
            {
                InternalWorkPoint = wp;
                AssemblyWorkPointDef wpDef = (AssemblyWorkPointDef)wp.Definition;
                wpDef.Point = point.ToPoint();
            }

            else
            {
                wp = binder.DocumentManager.ActiveAssemblyDoc.ComponentDefinition.WorkPoints.AddFixed(point.ToPoint(), false);
                InternalWorkPoint = wp;
                this.binder.SetObjectForTrace<InvWorkPoint>(this.InternalWorkPoint);
            }
        }
Esempio n. 3
0
        private InvWorkPoint(Point point, IObjectBinder binder)
        {
            this.point  = point;
            this.binder = binder;

            if (binder.DocumentManager.ActiveAssemblyDoc != null)
            {
                this.binder.ContextManager.BindingContextManager = binder.DocumentManager.ActiveAssemblyDoc.ReferenceKeyManager;
            }
            else if (binder.DocumentManager.ActivePartDoc != null)
            {
                this.binder.ContextManager.BindingContextManager = binder.DocumentManager.ActivePartDoc.ReferenceKeyManager;
            }
            this.binder.ContextManager.BindingContextManager = binder.DocumentManager.ActiveAssemblyDoc.ReferenceKeyManager;
            Inventor.WorkPoint wp;
            if (this.binder.GetObjectFromTrace <Inventor.WorkPoint>(out wp))
            {
                InternalWorkPoint = wp;
                AssemblyWorkPointDef wpDef = (AssemblyWorkPointDef)wp.Definition;
                wpDef.Point = point.ToPoint();
            }

            else
            {
                wp = binder.DocumentManager.ActiveAssemblyDoc.ComponentDefinition.WorkPoints.AddFixed(point.ToPoint(), false);
                InternalWorkPoint = wp;
                this.binder.SetObjectForTrace <InvWorkPoint>(this.InternalWorkPoint);
            }
        }
        protected override void DefineBindings(IObjectBinder objBinder)
        {
            var binder = (ObjectBinder <MainClass>)objBinder;

            binder.AddOption(mc => mc.Sub.IntProperty, "-i")
            .DefaultValue(-5);

            binder.AddOption(mc => mc.TextProperty, "-t")
            .DefaultValue("ralph");
        }
Esempio n. 5
0
 public static bool TryAssignKeyValues(this ICodec codec, IHttpEntity entity, IObjectBinder binder, Action<KeyedValues> assigned, Action<KeyedValues> failed)
 {
     return codec.ReadKeyValues(entity)
                 .AsObservable(x => from kv in x
                                   where kv.SetProperty(binder)
                                   select kv, 
                               assigned, 
                               failed)
                 .Count() > 0;
 }
 public static bool TryAssignKeyValues(this ICodec codec, IHttpEntity entity, IObjectBinder binder, Action <KeyedValues> assigned, Action <KeyedValues> failed)
 {
     return(codec.ReadKeyValues(entity)
            .AsObservable(x => from kv in x
                          where kv.SetProperty(binder)
                          select kv,
                          assigned,
                          failed)
            .Count() > 0);
 }
Esempio n. 7
0
        private InvWorkPoint(Point point, IObjectBinder binder)
        {
            _binder = binder;
            Inventor.WorkPoint wp;
            if (_binder.GetObjectFromTrace <Inventor.WorkPoint>(out wp))
            {
                InternalWorkPoint = wp;
                AssemblyWorkPointDef wpDef = (AssemblyWorkPointDef)wp.Definition;
                wpDef.Point = point.ToPoint();
            }

            else
            {
                wp = PersistenceManager.ActiveAssemblyDoc.ComponentDefinition.WorkPoints.AddFixed(point.ToPoint(), false);
                InternalWorkPoint = wp;
                _binder.SetObjectForTrace <WorkPoint>(this.InternalWorkPoint);
            }
        }
        protected override void DefineBindings(IObjectBinder objBinder)
        {
            base.DefineBindings(objBinder);

            var binder = (ObjectBinder <BetaDistribution>)objBinder;

            binder.AddOption(b => b.Alpha, "-a")
            .Description("alpha parameter for beta distribution of investment betas")
            .DefaultValue(1.0)
            .Validator(OptionInRange <double> .GreaterThan(0.0));

            binder.AddOption(b => b.Beta, "-b")
            .Description("beta parameter for beta distribution of investment betas")
            .DefaultValue(2.0)
            .Validator(OptionInRange <double> .GreaterThan(0.0));

            binder.AddOption(b => b.Maximum, "-x")
            .Description("maximum investment beta")
            .DefaultValue(2.0);

            binder.AddOption(b => b.Minimum, "-m")
            .Description("minimum investment beta")
            .DefaultValue(-2.0);
        }
Esempio n. 9
0
 public static void RegisterCustomObjectCreator(IObjectBinder objectBinder)
 {
     _objectBinder.Register(objectBinder);
 }
Esempio n. 10
0
 public void Register(IObjectBinder objectBinder)
 {
     _customObjectBinders.Add(objectBinder);
 }
Esempio n. 11
0
 public PropertyHandler(IObjectBinder parent) : base(parent)
 {
 }
Esempio n. 12
0
 public EventHandler(IObjectBinder parent)
     : base(parent)
 {
 }
Esempio n. 13
0
 public NestedTypeGetter(IObjectBinder parent)
     : base(parent)
 {
 }
Esempio n. 14
0
 public static void RegisterCustomObjectCreator(IObjectBinder objectBinder)
 {
     _customObjectBinders.Add(objectBinder);
 }
 public static bool TryAssignKeyValues(this ICodec codec, IHttpEntity entity, IObjectBinder binder)
 {
     return(TryAssignKeyValues(codec, entity, binder, null, null));
 }
Esempio n. 16
0
 public void Register(IObjectBinder objectBinder)
 {
     _customObjectBinders.Add(objectBinder);
 }
Esempio n. 17
0
 public NestedTypeGetter(IObjectBinder parent)
     : base(parent)
 {
 }
Esempio n. 18
0
 public InputMember(IMember member, IObjectBinder binder, bool isOptional)
 {
     this.Member = member;
     this.Binder = binder;
     this.IsOptional = isOptional;
 }
Esempio n. 19
0
 public static bool TryAssignKeyValues(this ICodec codec, IHttpEntity entity, IObjectBinder binder)
 {
     return TryAssignKeyValues(codec, entity, binder, null, null);
 }
Esempio n. 20
0
 public FieldHandler(IObjectBinder parent)
     : base(parent)
 {
 }
Esempio n. 21
0
 public MethodGetter(IObjectBinder parent)
     : base(parent)
 {
 }
Esempio n. 22
0
 public override bool SetProperty(IObjectBinder binder)
 {
     return(WasUsed = binder.SetProperty(Key, Values, Converter));
 }
Esempio n. 23
0
 public BaseHandler(IObjectBinder parent)
 {
     binder = parent;
 }
Esempio n. 24
0
 public static void RegisterCustomObjectCreator(IObjectBinder objectBinder)
 {
     _objectBinder.Register(objectBinder);
 }
Esempio n. 25
0
 public EventHandler(IObjectBinder parent)
     : base(parent)
 {
 }
Esempio n. 26
0
 public MethodGetter(IObjectBinder parent)
     : base(parent)
 {
 }
Esempio n. 27
0
 /// <summary>
 /// Tries to set the value on the provided object binder.
 /// </summary>
 /// <param name="binder">The <see cref="IObjectBinder"/> to use when applying the value.</param>
 /// <returns><c>true</c> if the assignment was successful, otherwise <c>false</c>.</returns>
 public abstract bool SetProperty(IObjectBinder binder);
Esempio n. 28
0
 public PropertyHandler(IObjectBinder parent)
     : base(parent)
 {
 }
Esempio n. 29
0
        public static CommandLineBuilder UseObjectBinder(this CommandLineBuilder builder, IObjectBinder objBinder)
        {
            builder.UseMiddleware(async(context, next) =>
            {
                var resultCode = await objBinder.Bind(context);
                await next(context);
            });

            return(builder);
        }
Esempio n. 30
0
 public ScriptableHandler(IObjectBinder parent)
     : base(parent)
 {
 }
Esempio n. 31
0
 public BaseHandler(IObjectBinder parent)
 {
     binder = parent;
 }
Esempio n. 32
0
 public FieldHandler(IObjectBinder parent)
     : base(parent)
 {
 }
Esempio n. 33
0
 public OperationMember(IMember member, IObjectBinder binder, bool isOptional)
 {
     Member     = member;
     Binder     = binder;
     IsOptional = isOptional;
 }
Esempio n. 34
0
 public OperationMember(IMember member, IObjectBinder binder, bool optional)
 {
     this.Member = member;
     this.Binder = binder;
     this.IsOptional = optional;
 }
Esempio n. 35
0
 public ScriptableHandler(IObjectBinder parent)
     : base(parent)
 {
 }
Esempio n. 36
0
 public static void RegisterCustomObjectCreator(IObjectBinder objectBinder)
 {
     _customObjectBinders.Add(objectBinder);
 }
Esempio n. 37
0
 /// <summary>
 /// Tries to set the value on the provided object binder.
 /// </summary>
 /// <param name="binder">The <see cref="IObjectBinder"/> to use when applying the value.</param>
 /// <returns><c>true</c> if the assignment was successful, otherwise <c>false</c>.</returns>
 public abstract bool SetProperty(IObjectBinder binder);
Esempio n. 38
0
        private InvWorkPoint(Point point, IObjectBinder binder)
        {
            _binder = binder;
            Inventor.WorkPoint wp;
            if (_binder.GetObjectFromTrace<Inventor.WorkPoint>(out wp))
            {
                InternalWorkPoint = wp;
                AssemblyWorkPointDef wpDef = (AssemblyWorkPointDef)wp.Definition;               
                wpDef.Point = point.ToPoint();
            }

            else
            {
                wp = PersistenceManager.ActiveAssemblyDoc.ComponentDefinition.WorkPoints.AddFixed(point.ToPoint(), false);
                InternalWorkPoint = wp;
                _binder.SetObjectForTrace<WorkPoint>(this.InternalWorkPoint);
            }
        }
Esempio n. 39
0
 public SandboxBinder(IObjectBinder orig)
 {
     _orig = orig;
 }
Esempio n. 40
0
 public InputMember(IMember member, IObjectBinder binder, bool isOptional)
 {
     Member = member;
     Binder = binder;
     IsOptional = isOptional;
 }
Esempio n. 41
0
 protected virtual void DefineBindings(IObjectBinder objBinder)
 {
 }