Ejemplo n.º 1
0
 private XElement CreateOutParamElement(OutParameter param)
 {
     return(new XElement("outParam",
                         new XAttribute("name", param.Name ?? string.Empty),
                         new XAttribute("type", param.Type.Name),
                         new XElement("description", param.Description)
                         ));
 }
        public Expression Update(Identifier Expression, ParameterExpression directionExpression)
        {
            if (IdentifierParameter.Equals(Expression) && OutParameter.Equals(directionExpression))
            {
                return(this);
            }

            return(AstExpression.Direction(_directionExpression, ParentScope, Visitor));
        }
Ejemplo n.º 3
0
        //main controller
        public void Controller()
        {
            dynamic jParsed;

            using (StreamReader r = new StreamReader("./src/resources/config.json"))
            {
                jParsed = JObject.Parse(r.ReadToEnd());
            }

            var parameters = Builder <Parameters> .CreateNew().With(x => x.Strategy = jParsed.strategy)
                             .With(x => x.Period = jParsed.period).With(x => x.Period_1 = jParsed.period_1)
                             .With(x => x.Limit  = jParsed.limit).Build();

            Predictor predictor = new Predictor(parameters);

            Console.WriteLine("Coin\tCurrent\tPredictedClose\tBUY/SELL\tTime");
            foreach (var item in jParsed.coins)
            {
                parameters.Coin = item;
                OutParameter outParameter = predictor.InitialForecast();
                Console.WriteLine(outParameter.Coin + "\t" + outParameter.Current + "\t" + outParameter.Predicted
                                  + "\t" + outParameter.Decision + "\t" + DateTime.Now.ToString());
            }


            for (; ;)
            {
                Thread.Sleep(10000);
                foreach (var item in jParsed.coins)
                {
                    parameters.Coin = item;
                    OutParameter outParameter = predictor.ForeCastNextPrice();
                    Console.WriteLine(outParameter.Coin + "\t" + outParameter.Current + "\t" + outParameter.Predicted
                                      + "\t" + outParameter.Decision + "\t" + DateTime.Now.ToString());
                }
            }
        }
Ejemplo n.º 4
0
        public object GetOutParameter(List <OutParameter> parametrosSalida, string nombreParametro)
        {
            OutParameter parametroSalida = parametrosSalida.Find(delegate(OutParameter outParam) { return(outParam.nombre == "nombreParametro"); });

            return(parametroSalida.valor);
        }
Ejemplo n.º 5
0
        private static Method CreateMethod(MoaiClass moaiClass, Annotation[] annotations, MethodPosition methodPosition, TypeCollection types, WarningList warnings)
        {
            // Get @lua annotation
            var luaNameAnnotation = GetNameAnnotation(moaiClass, annotations, methodPosition, warnings);

            if (luaNameAnnotation == null)
            {
                return(null);
            }

            // Check that there is a single @text annotation
            CheckTextAnnotation(annotations, methodPosition, warnings);

            // Parse annotations
            var method = new Method {
                MethodPosition = methodPosition,
                Name           = luaNameAnnotation.Value,
                OwningClass    = moaiClass,
            };

            moaiClass.Members.Add(method);
            MethodOverload currentOverload = null;

            foreach (var annotation in annotations)
            {
                if (annotation is LuaNameAnnotation)
                {
                    // Nothing to do - name has already been set.
                }
                else if (annotation is TextAnnotation)
                {
                    // Set method description
                    method.Description = ((TextAnnotation)annotation).Value;
                }
                else if (annotation is ParameterAnnotation)
                {
                    if (currentOverload == null)
                    {
                        currentOverload = new MethodOverload {
                            OwningMethod = method
                        };
                        method.Overloads.Add(currentOverload);
                    }
                    var    parameterAnnotation = (ParameterAnnotation)annotation;
                    string paramName           = parameterAnnotation.Name;
                    if (annotation is InParameterAnnotation | annotation is OptionalInParameterAnnotation)
                    {
                        // Add input parameter
                        if (currentOverload.InParameters.Any(param => param.Name == paramName))
                        {
                            warnings.Add(methodPosition, WarningType.UnexpectedValue,
                                         "Found multiple params with name '{0}' for single overload.", paramName);
                        }
                        var inParameter = new InParameter {
                            Name        = paramName,
                            Description = parameterAnnotation.Description,
                            Type        = types.GetOrCreate(parameterAnnotation.Type, methodPosition),
                            IsOptional  = annotation is OptionalInParameterAnnotation
                        };
                        currentOverload.InParameters.Add(inParameter);
                    }
                    else
                    {
                        // Add output parameter
                        var outParameter = new OutParameter {
                            Name        = paramName,
                            Type        = types.GetOrCreate(parameterAnnotation.Type, methodPosition),
                            Description = parameterAnnotation.Description
                        };
                        currentOverload.OutParameters.Add(outParameter);
                    }
                }
                else if (annotation is OverloadAnnotation)
                {
                    // Let the next parameter annotation start a new override
                    currentOverload = null;
                }
                else
                {
                    warnings.Add(methodPosition, WarningType.UnexpectedAnnotation,
                                 "Unexpected {0} annotation.", annotation.Command);
                }
            }
            return(method);
        }
 public void Write(TProtocol oprot)
 {
     oprot.IncrementRecursionDepth();
     try
     {
         TStruct struc = new TStruct("RoutineDTO");
         oprot.WriteStructBegin(struc);
         TField field = new TField();
         if (Id != null && __isset.id)
         {
             field.Name = "id";
             field.Type = TType.String;
             field.ID   = 1;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(Id);
             oprot.WriteFieldEnd();
         }
         if (__isset.privateRoutine)
         {
             field.Name = "privateRoutine";
             field.Type = TType.Bool;
             field.ID   = 2;
             oprot.WriteFieldBegin(field);
             oprot.WriteBool(PrivateRoutine);
             oprot.WriteFieldEnd();
         }
         if (Name != null && __isset.name)
         {
             field.Name = "name";
             field.Type = TType.String;
             field.ID   = 3;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(Name);
             oprot.WriteFieldEnd();
         }
         if (Description != null && __isset.description)
         {
             field.Name = "description";
             field.Type = TType.String;
             field.ID   = 4;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(Description);
             oprot.WriteFieldEnd();
         }
         if (__isset.revision)
         {
             field.Name = "revision";
             field.Type = TType.I16;
             field.ID   = 5;
             oprot.WriteFieldBegin(field);
             oprot.WriteI16(Revision);
             oprot.WriteFieldEnd();
         }
         if (__isset.type)
         {
             field.Name = "type";
             field.Type = TType.I32;
             field.ID   = 6;
             oprot.WriteFieldBegin(field);
             oprot.WriteI32((int)Type);
             oprot.WriteFieldEnd();
         }
         if (__isset.language)
         {
             field.Name = "language";
             field.Type = TType.I32;
             field.ID   = 7;
             oprot.WriteFieldBegin(field);
             oprot.WriteI32((int)Language);
             oprot.WriteFieldEnd();
         }
         if (InParameters != null && __isset.inParameters)
         {
             field.Name = "inParameters";
             field.Type = TType.List;
             field.ID   = 8;
             oprot.WriteFieldBegin(field);
             {
                 oprot.WriteListBegin(new TList(TType.Struct, InParameters.Count));
                 foreach (FormalParameterDTO _iter30 in InParameters)
                 {
                     _iter30.Write(oprot);
                 }
                 oprot.WriteListEnd();
             }
             oprot.WriteFieldEnd();
         }
         if (OutParameter != null && __isset.outParameter)
         {
             field.Name = "outParameter";
             field.Type = TType.Struct;
             field.ID   = 9;
             oprot.WriteFieldBegin(field);
             OutParameter.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (RoutineBinaries != null && __isset.routineBinaries)
         {
             field.Name = "routineBinaries";
             field.Type = TType.Set;
             field.ID   = 10;
             oprot.WriteFieldBegin(field);
             {
                 oprot.WriteSetBegin(new TSet(TType.Struct, RoutineBinaries.Count));
                 foreach (RoutineBinaryDTO _iter31 in RoutineBinaries)
                 {
                     _iter31.Write(oprot);
                 }
                 oprot.WriteSetEnd();
             }
             oprot.WriteFieldEnd();
         }
         if (Arguments != null && __isset.arguments)
         {
             field.Name = "arguments";
             field.Type = TType.List;
             field.ID   = 11;
             oprot.WriteFieldBegin(field);
             {
                 oprot.WriteListBegin(new TList(TType.String, Arguments.Count));
                 foreach (string _iter32 in Arguments)
                 {
                     oprot.WriteString(_iter32);
                 }
                 oprot.WriteListEnd();
             }
             oprot.WriteFieldEnd();
         }
         oprot.WriteFieldStop();
         oprot.WriteStructEnd();
     }
     finally
     {
         oprot.DecrementRecursionDepth();
     }
 }