Example #1
0
 public override void CountUses(Typ typ, HashBag <FullCellAddr> numberUses)
 {
     foreach (CGExpr e in es)
     {
         e.CountUses(Typ.Number, numberUses);
     }
 }
Example #2
0
		private void LoadTypTree(DataCollection<TreeEntryClass> _typTree)
			{
			foreach (DataRow RootDataTemplateRow in DataModell.DataSetForStaticTables.Tables["RootDataTemplates"].Rows)
				{
				RootDataTemplates RootTyp = new RootDataTemplates(RootDataTemplateRow);
				_typTree.Add(new TreeEntryClass()
					{
					Parent = null,
					HeadLine = RootTyp.NameID,
					ConnectedObject = RootTyp
					});
				foreach (DataRow TypRow in DataModell.DataSetForStaticTables.Tables["Typ"].Rows)
					{
					if (((Guid)TypRow["RootFormat"]) != RootTyp.ID)
						continue;
					Typ SelectableTyp = new Typ(TypRow);
					_typTree.Last().Childs.Add(new TreeEntryClass()
						{
						Parent = _typTree.Last(),
						HeadLine = SelectableTyp.NameID,
						ConnectedObject = SelectableTyp
						});
					}
				}
			}
        public ServiceDetails(ProtoCatalog catalog, string ns, ServiceDescriptor desc, ServiceConfig grpcServiceConfig)
        {
            Catalog            = catalog;
            Namespace          = ns;
            ProtoPackage       = desc.File.Package;
            DocLines           = desc.Declaration.DocLines().ToList();
            SnippetsNamespace  = $"{ns}.Snippets";
            UnitTestsNamespace = $"{ns}.Tests";
            // Must come early; used by `MethodDetails.Create()`
            MethodGrpcConfigsByName = grpcServiceConfig?.MethodConfig
                                      .SelectMany(conf => conf.Name.Select(name => (name, conf)))
                                      .Where(x => x.name.Service == desc.FullName)
                                      .ToImmutableDictionary(x => $"{x.name.Service}/{x.name.Method}", x => x.conf) ??
                                      ImmutableDictionary <string, MethodConfig> .Empty;
            ServiceFullName   = desc.FullName;
            ServiceName       = desc.Name;
            DocumentationName = desc.Name; // TODO: There may be a more suitable name than this.
            ProtoTyp          = Typ.Manual(ns, desc.Name);
            GrpcClientTyp     = Typ.Nested(ProtoTyp, $"{desc.Name}Client");
            SettingsTyp       = Typ.Manual(ns, $"{desc.Name}Settings");
            BuilderTyp        = Typ.Manual(ns, $"{desc.Name}ClientBuilder");
            ClientAbstractTyp = Typ.Manual(ns, $"{desc.Name}Client");
            ClientImplTyp     = Typ.Manual(ns, $"{desc.Name}ClientImpl");
            DefaultHost       = desc.GetExtension(ClientExtensions.DefaultHost) ?? "";
            DefaultPort       = 443; // Hardcoded; this is not specifiable by proto annotation.
            var oauthScopes = desc.GetExtension(ClientExtensions.OauthScopes);

            DefaultScopes         = string.IsNullOrEmpty(oauthScopes) ? Enumerable.Empty <string>() : oauthScopes.Split(',', ' ');
            Methods               = desc.Methods.Select(x => MethodDetails.Create(this, x)).ToList();
            SnippetsTyp           = Typ.Manual(SnippetsNamespace, $"Generated{desc.Name}ClientSnippets");
            StandaloneSnippetsTyp = Typ.Manual(SnippetsNamespace, $"Generated{desc.Name}ClientStandaloneSnippets");
            SnippetsClientName    = $"{desc.Name.ToLowerCamelCase()}Client";
            UnitTestsTyp          = Typ.Manual(UnitTestsNamespace, $"Generated{desc.Name}ClientTest");
            NonStandardLro        = NonStandardLroDetails.ForService(desc);
        }
Example #4
0
        public PackageModel(RestDescription discoveryDoc)
        {
            _discoveryDoc = discoveryDoc;
            ApiName       = discoveryDoc.Name;

            // Note that spaces are removed first, because the Python code doesn't Pascal-case them. For example,
            // the "Cloud Memorystore for Memcached" API has a package name of "CloudMemorystoreforMemcached".
            // It's awful, but that's the way it works...
            ClassName        = (discoveryDoc.CanonicalName ?? discoveryDoc.Name).Replace(" ", "").ToMemberName();
            ServiceClassName = $"{ClassName}Service";
            ApiVersion       = discoveryDoc.Version;
            VersionNoDots    = discoveryDoc.Version.Replace('.', '_');
            PackageName      = $"Google.Apis.{ClassName}.{VersionNoDots}";
            DataModels       = discoveryDoc.Schemas.ToReadOnlyList(pair => new DataModel(this, parent: null, name: pair.Key, schema: pair.Value));

            // Populate the data model dictionary early, as methods and resources refer to the data model types.
            foreach (var dm in DataModels)
            {
                _dataModels[dm.Id] = dm;
            }
            Resources   = discoveryDoc.Resources.ToReadOnlyList(pair => new ResourceModel(this, parent: null, pair.Key, pair.Value));
            ApiFeatures = discoveryDoc.Features.ToReadOnlyList();
            // TODO: Ordering?
            AuthScopes = (discoveryDoc.Auth?.Oauth2?.Scopes).ToReadOnlyList(pair => new AuthScope(pair.Key, pair.Value.Description));
            ServiceTyp = Typ.Manual(PackageName, ServiceClassName);
            GenericBaseRequestTypDef = Typ.Manual(PackageName, $"{ClassName}BaseServiceRequest");
            BaseRequestTyp           = Typ.Generic(GenericBaseRequestTypDef, Typ.GenericParam("TResponse"));
            BaseUri   = discoveryDoc.RootUrl + discoveryDoc.ServicePath;
            BasePath  = discoveryDoc.ServicePath;
            BatchUri  = discoveryDoc.RootUrl + discoveryDoc.BatchPath;
            BatchPath = discoveryDoc.BatchPath;
            Title     = discoveryDoc.Title;
            Methods   = discoveryDoc.Methods.ToReadOnlyList(pair => new MethodModel(this, null, pair.Key, pair.Value));
        }
Example #5
0
 // ctor
 public Akkuschrauber(int id, string modell, double preis, Typ akkuTyp)
 {
     Id      = id;
     Modell  = modell;
     Preis   = preis;
     AkkuTyp = akkuTyp;
 }
        public void GetTypesByIdRuleTest(int typeId, string typeName)
        {
            var repo = CarDearlershipRespoFacotory.GetRepository();
            Typ type = repo.GetTypesById(typeId);

            Assert.AreEqual(typeName, type.TypeName);
        }
 public DbsyncTvTypeType(Typ tt)
 {
     this.t = tt;
     this.Text = t.Nazov;
     this.typeOfIcon = TypeIcon;
     this.Name = this.Text;
 }
Example #8
0
    public static void PokazWeglowodor(int wegiel, Typ typ)
    {
        Console.WriteLine("*Węglowodór*");

        string nazwa, wzor, stan;

        // Nie istnieją alkeny i alkiny z 1 atomem węgla
        if (1 == wegiel && Typ.Alkan != typ)
        {
            nazwa = wzor = stan = Stale.blad;
        }
        else
        {
            nazwa = Funkcje.NazwaZSzeregu(wegiel) + Stale.koncowki[(int)typ];
            stan  = wegiel < Stale.granicaGazu ? "gaz" : "ciecz";
            int wodor = wegiel * 2;
            if (Typ.Alken != typ)
            {
                wodor += (Typ.Alkan == typ ? 2 : -2);
            }
            wzor = "C" + Funkcje.LiczbaAtomow(wegiel) + "H" + wodor;
        }

        Funkcje.PokazWszystko(nazwa, wzor, stan);
    }
            public TypeSyntax Type0(Typ typ)
            {
                SimpleNameSyntax simpleName = IdentifierName(typ.Name);

                if (typ.GenericArgTyps != null)
                {
                    // Generic typ, so return a generic name by recursively calling this method on all type args.
                    simpleName = GenericName(simpleName.Identifier, TypeArgumentList(SeparatedList(typ.GenericArgTyps.Select(Type))));
                }
                NameSyntax result = simpleName;

                if (typ.Namespace != Namespace)
                {
                    // TODO: It feels like there must be a better way of doing this...
                    var        segments      = typ.Namespace.Split('.');
                    NameSyntax namespaceName = IdentifierName(segments[0]);
                    foreach (var segment in segments.Skip(1))
                    {
                        namespaceName = QualifiedName(namespaceName, IdentifierName(segment));
                    }
                    result = QualifiedName(namespaceName, simpleName);
                }

                return(result);
            }
 public ServerStreaming(ServiceDetails svc, MethodDescriptor desc) : base(svc, desc)
 {
     ApiCallTyp         = Typ.Generic(typeof(ApiServerStreamingCall <,>), RequestTyp, ResponseTyp);
     AbstractStreamTyp  = Typ.Nested(svc.ClientAbstractTyp, $"{SyncMethodName}Stream");
     ImplStreamTyp      = Typ.Nested(svc.ClientImplTyp, $"{SyncMethodName}StreamImpl");
     AsyncEnumeratorTyp = Typ.Generic(typeof(AsyncResponseStream <>), ResponseTyp);
 }
            public StandardLro(ServiceDetails svc, MethodDescriptor desc) : base(svc, desc)
            {
                OperationInfo lroData = desc.GetExtension(OperationsExtensions.OperationInfo);

                if (lroData is null)
                {
                    throw new InvalidOperationException("LRO method must contain a `google.api.operation` option.");
                }
                ApiCallTyp = Typ.Generic(typeof(ApiCall <,>), RequestTyp, Typ.Of <Operation>());
                if (string.IsNullOrEmpty(lroData.ResponseType) || string.IsNullOrEmpty(lroData.MetadataType))
                {
                    throw new InvalidOperationException($"Both response-type and metadata-type must be present for method: '{desc.FullName}'.");
                }
                var responseTypeMsg = svc.Catalog.GetMessageByName(lroData.ResponseType);
                var metadataTypeMsg = svc.Catalog.GetMessageByName(lroData.MetadataType);

                if (responseTypeMsg is null || metadataTypeMsg is null)
                {
                    throw new InvalidOperationException(
                              $"Response-type and Metadata-type must both exist in method '{desc.FullName}': '{lroData.ResponseType}', '{lroData.MetadataType}'.");
                }
                OperationResponseTyp = ProtoTyp.Of(responseTypeMsg);
                OperationMetadataTyp = ProtoTyp.Of(metadataTypeMsg);
                SyncReturnTyp        = Typ.Generic(typeof(Operation <,>), OperationResponseTyp, OperationMetadataTyp);
            }
Example #12
0
 public PersonalData(string name, string surname)
 {
     Name          = name;
     SurName       = surname;
     NameOfCompany = "-";
     Type          = Typ.KlientPrywatny;
 }
Example #13
0
 public PersonalData(string com)
 {
     Name          = "-";
     SurName       = "-";
     NameOfCompany = com;
     Type          = Typ.Firma;
 }
Example #14
0
 public void ChangeToPrivate(string name, string surname)
 {
     Type          = Typ.KlientPrywatny;
     Name          = name;
     SurName       = surname;
     NameOfCompany = null;
 }
Example #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="pudink.Brouk"/> class.
 /// </summary>
 /// <param name="texset">Texture set.</param>
 /// <param name="typ">Type.</param>
 public Brouk(TextureSet texset,Typ typ)
 {
     this.textureset = texset;
     this.typbug = typ;
     this.NastavTyp (typ);
     this.schopnosti = new Abilities (typ);
 }
Example #16
0
        internal static string GetTerp(Ticket ticket, Typ typ)
        {
            string _typ;

            _typ = string.Empty;

            switch (typ)
            {
            case Typ.Normal:
                _typ = Zakaznici.Terpy.Get <NbtCompound>("Typ").Get <NbtString>("Normal").Value;
                break;

            case Typ.Prescas:
                _typ = Zakaznici.Terpy.Get <NbtCompound>("Typ").Get <NbtString>("Prescas").Value;
                break;

            case Typ.Svatek:
                _typ = Zakaznici.Terpy.Get <NbtCompound>("Typ").Get <NbtString>("Svatek").Value;
                break;

            case Typ.Nahradni:
                _typ = Zakaznici.Terpy.Get <NbtCompound>("Typ").Get <NbtString>("Nahradni").Value;
                break;

            default:
                _typ = "-";
                break;
            }

            return(ticket.CustomTerp + "," + ticket.CustomTask + "," + _typ + ",");
        }
Example #17
0
        private static IEnumerable <MemberDeclarationSyntax> PaginatedPartialClasses(SourceFileContext ctx, ServiceDetails svc, HashSet <Typ> seenPaginatedResponseTyps)
        {
            var paginatedMethods = svc.Methods.OfType <MethodDetails.Paginated>();

            foreach (var representingMethod in paginatedMethods
                     .GroupBy(m => m.RequestTyp)
                     .Select(typMethodGrp => typMethodGrp.First()))
            {
                yield return(PaginatedPartialInterfaceClass(ctx, representingMethod.RequestTyp, representingMethod.RequestMessageDesc));
            }

            foreach (var method in paginatedMethods)
            {
                if (seenPaginatedResponseTyps.Add(method.ResponseTyp))
                {
                    var cls = Class(Public | Partial, method.ResponseTyp, baseTypes: ctx.Type(Typ.Generic(typeof(IPageResponse <>), method.ResourceTyp)));
                    using (ctx.InClass(cls))
                    {
                        var propertyName         = method.ResourcesFieldName;
                        var genericGetEnumerator = Method(Public, ctx.Type(Typ.Generic(typeof(IEnumerator <>), method.ResourceTyp)), "GetEnumerator")()
                                                   .WithBody(Property(Public, ctx.TypeDontCare, propertyName).Call(nameof(IEnumerable <int> .GetEnumerator))())
                                                   .WithXmlDoc(XmlDoc.Summary("Returns an enumerator that iterates through the resources in this response."));
                        var getEnumerator = Method(None, ctx.Type <IEnumerator>(), "GetEnumerator")()
                                            .WithExplicitInterfaceSpecifier(ctx.Type <IEnumerable>())
                                            .WithBody(This.Call(genericGetEnumerator)());
                        cls = cls.AddMembers(genericGetEnumerator, getEnumerator);
                    }
                    yield return(cls);
                }
            }
        }
Example #18
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject parent = transform.parent.gameObject;

        if (parent.GetComponent <Master>() != null)
        {
            typ = Typ.master; master = parent.GetComponent <Master>();
        }
        else if (parent.GetComponent <ToolShop>() != null)
        {
            typ = Typ.toolshop; toolShop = parent.GetComponent <ToolShop>();
        }
        else if (parent.GetComponent <IronPile>() != null)
        {
            typ = Typ.ironpile; ironPile = parent.GetComponent <IronPile>();
        }
        else if (parent.GetComponent <BuildSite>() != null)
        {
            typ = Typ.buildsite; buildSite = parent.GetComponent <BuildSite>();
        }
        else if (parent.GetComponent <Farm>() != null)
        {
            typ = Typ.farm; farm = parent.GetComponent <Farm>();
        }
        else
        {
            throw new System.NotImplementedException("typ not available yet for go: " + parent);
        }
    }
 public ResourceClassBuilder(SourceFileContext ctx, ResourceDetails.Definition def)
 {
     _ctx = ctx;
     _def = def;
     ResourceNameTypeTyp = Typ.Nested(def.ResourceNameTyp, "ResourceNameType", isEnum: true);
     PatternDetails      = _def.Patterns.Where(x => !x.IsWildcard).Select(x => new PatternDetails(ctx, def, x)).ToList();
 }
Example #20
0
 // Ctor for wildcard only.
 private Definition()
 {
     Patterns          = new[] { new Pattern("*") };
     ResourceNameTyp   = Typ.Of <IResourceName>();
     ResourceParserTyp = Typ.Of <UnparsedResourceName>();
     IsUnparsed        = true;
 }
Example #21
0
		public CGExtern(CGExpr[] es)
			: base(es, null) {
			if (es.Length < 1) {
				errorValue = ErrorValue.argCountError;
			}
			else {
				CGTextConst nameAndSignatureConst = es[0] as CGTextConst;
				if (nameAndSignatureConst == null) {
					errorValue = ErrorValue.argTypeError;
				}
				else {
					try {
						// This retrieves the method from cache, or creates it:
						ef = ExternalFunction.Make(nameAndSignatureConst.value.value);
						if (ef.arity != es.Length - 1) {
							ef = null;
							errorValue = ErrorValue.argCountError;
						}
						else {
							resType = FromType(ef.ResType);
							argTypes = new Typ[ef.arity];
							for (int i = 0; i < argTypes.Length; i++) {
								argTypes[i] = FromType(ef.ArgType(i));
							}
						}
					}
					catch (Exception exn) // Covers a multitude of sins
					{
						errorValue = ErrorValue.Make(exn.Message);
					}
				}
			}
		}
        private static MethodDeclarationSyntax GenerateMethod(SourceFileContext ctx, ServiceDetails service)
        {
            var name = $"Add{service.ClientAbstractTyp.Name}";
            var serviceCollection = ctx.Type <IServiceCollection>();
            var services          = Parameter(serviceCollection, "services")
                                    .WithModifiers(SyntaxTokenList.Create(Token(SyntaxKind.ThisKeyword).WithTrailingSpace()));
            var actionType = ctx.Type(Typ.Generic(typeof(Action <>), service.BuilderTyp));
            var action     = Parameter(actionType, "action", @default: Null);

            var builderType = ctx.Type(service.BuilderTyp);
            var builder     = Local(builderType, "builder");

            var provider = Parameter(ctx.Type <IServiceProvider>(), "provider");
            var lambda   = Lambda(provider)(
                builder.WithInitializer(New(builderType)()),
                action.Call("Invoke", true)(builder),
                Return(builder.Call("Build")(provider))
                );

            return(Method(Public | Static, serviceCollection, name)(services, action)
                   .WithBody(services.Call("AddSingleton")(lambda))
                   .WithXmlDoc(
                       XmlDoc.Summary("Adds a singleton ", ctx.Type(service.ClientAbstractTyp), " to ", services, "."),
                       XmlDoc.Param(services, "The service collection to add the client to. The services are used to configure the client when requested."),
                       XmlDoc.Param(action, "An optional action to invoke on the client builder. This is invoked before services from ", services, " are used.")
                       ));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="Local"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="type">The type.</param>
 /// <param name="modifyInBlock">Refers to  __block attribute of Objective-C variables.
 /// <c>true</c> if it will be modified inside a block; otherwise, <c>false</c>.</param>
 /// <param name="isConstExpr">if set to <c>true</c> [is constant expr].</param>
 public Local(string name, Typ type, bool modifyInBlock, bool isConstExpr)
 {
     Name          = name;
     Type          = type;
     ModifyInBlock = modifyInBlock;
     IsConstExpr   = isConstExpr;
 }
Example #24
0
            public Definition(FileDescriptor fileDesc, MessageDescriptor msgDesc, string type, string nameField, CommonResource common, IEnumerable <string> patterns)
            {
                MsgDesc  = msgDesc;
                FileName = fileDesc.Name;
                UnifiedResourceTypeName = type;
                var typeNameParts = type.Split('/');

                if (typeNameParts.Length != 2)
                {
                    throw new InvalidOperationException($"Invalid unified resource name: '{type}' used in message '{msgDesc?.Name}'");
                }
                ShortName = typeNameParts[1];
                FieldName = ShortName.ToLowerCamelCase();
                NameField = string.IsNullOrEmpty(nameField) ? "name" : nameField;
                DocName   = ShortName;
                Patterns  = patterns.Select(x => new Pattern(x)).ToList();
                if (patterns.Distinct().Count() != Patterns.Count)
                {
                    throw new InvalidOperationException("All patterns must be unique within a resource-name.");
                }
                IsCommon        = common != null;
                ResourceNameTyp = IsCommon ?
                                  Typ.Manual(common.CsharpNamespace, common.CsharpClassName) :
                                  Typ.Manual(fileDesc.CSharpNamespace(), $"{ShortName}Name");
                ResourceParserTyp = ResourceNameTyp;
                IsUnparsed        = false;
            }
Example #25
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool prvniRadek = true;

            string[]        popisky;
            List <string[]> radky = new List <string[]>();
            DataTable       dt    = new DataTable();

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                StreamReader sr = new StreamReader(openFileDialog1.FileName);
                while (sr.Peek() >= 0)
                {
                    if (prvniRadek)
                    {
                        string prvni = sr.ReadLine();
                        popisky = prvni.Split(';');
                        int i = 0;
                        foreach (string sloupec in popisky)
                        {
                            dt.Columns.Add(sloupec + i++);
                        }
                    }
                    radky.Add(sr.ReadLine().Split(';'));

                    prvniRadek = false;
                }
                foreach (var item in radky)
                {
                    dt.Rows.Add(item);
                }
                Typ test = new Typ(openFileDialog1.FileName);
                dataGridView1.DataSource = test.Data;
            }
        }
Example #26
0
 public Angriff(int id, String name, int schaden, Typ typ)
 {
     Id      = id;
     Typ     = typ;
     Schaden = schaden;
     Name    = name;
 }
Example #27
0
 public Matratt(string namn, decimal pris, Typ typ, int antalKalorier)
 {
     this.namn          = namn;
     this.pris          = pris;
     this.typ           = typ;
     this.antalKalorier = antalKalorier;
 }
Example #28
0
        public PackageModel(RestDescription discoveryDoc, Features features, PackageEnumStorage enumStorage)
        {
            _features     = features;
            _discoveryDoc = discoveryDoc;
            ApiName       = discoveryDoc.Name;

            // Note that spaces are removed first, because the Python code doesn't Pascal-case them. For example,
            // the "Cloud Memorystore for Memcached" API has a package name of "CloudMemorystoreforMemcached".
            // It's awful, but that's the way it works...
            ClassName  = (discoveryDoc.CanonicalName ?? discoveryDoc.Name).Replace(" ", "").ToMemberName();
            ApiVersion = discoveryDoc.Version;
            string versionNoDots        = discoveryDoc.Version.Replace('.', '_');
            var    camelizedPackagePath = discoveryDoc.PackagePath is null
                ? ""
                : string.Join('.', discoveryDoc.PackagePath.Split('/').Select(part => part.ToUpperCamelCase())) + ".";

            PackageName = $"Google.Apis.{camelizedPackagePath}{ClassName}.{versionNoDots}";
            DataModels  = discoveryDoc.Schemas.ToReadOnlyList(pair => new DataModel(this, parent: null, name: pair.Key, schema: pair.Value));

            // Populate the data model dictionary early, as methods and resources refer to the data model types.
            foreach (var dm in DataModels)
            {
                _dataModelsById[dm.Id] = dm;
            }
            Resources = discoveryDoc.Resources.ToReadOnlyList(pair => new ResourceModel(this, parent: null, pair.Key, pair.Value));
            // TODO: Ordering?
            AuthScopes = (discoveryDoc.Auth?.Oauth2?.Scopes).ToReadOnlyList(pair => new AuthScope(pair.Key, pair.Value.Description));
            ServiceTyp = Typ.Manual(PackageName, $"{ClassName}Service");
            GenericBaseRequestTypDef = Typ.Manual(PackageName, $"{ClassName}BaseServiceRequest");
            Methods            = discoveryDoc.Methods.ToReadOnlyList(pair => new MethodModel(this, null, pair.Key, pair.Value));
            PackageEnumStorage = enumStorage;
        }
Example #29
0
        public ClassDeclarationSyntax GenerateBaseRequestClass(SourceFileContext ctx)
        {
            var cls = Class(
                Modifier.Public | Modifier.Abstract,
                BaseRequestTyp,
                ctx.Type(Typ.Generic(typeof(ClientServiceRequest <>), Typ.GenericParam("TResponse"))))
                      .WithXmlDoc(XmlDoc.Summary($"A base abstract class for {ClassName} requests."));

            using (ctx.InClass(BaseRequestTyp))
            {
                var serviceParam = Parameter(ctx.Type <IClientService>(), "service");
                var ctor         = Ctor(Modifier.Protected, cls, BaseInitializer(serviceParam))(serviceParam)
                                   .WithBody()
                                   .WithXmlDoc(XmlDoc.Summary($"Constructs a new {ClassName}BaseServiceRequest instance."));

                var parameters = CreateParameterList(BaseRequestTyp);

                cls = cls.AddMembers(ctor);
                cls = cls.AddMembers(parameters.SelectMany(p => p.GenerateDeclarations(ctx)).ToArray());

                var initParameters = Method(Modifier.Protected | Modifier.Override, VoidType, "InitParameters")()
                                     .WithBlockBody(
                    BaseExpression().Call("InitParameters")(),
                    parameters.Select(p => p.GenerateInitializer(ctx)).ToArray())
                                     .WithXmlDoc(XmlDoc.Summary($"Initializes {ClassName} parameter list."));

                cls = cls.AddMembers(initParameters);
            }
            return(cls);
        }
Example #30
0
 public Samolot(string id, string producent, Typ typ, Naped naped, double zasieg, double predkoscMaksymalna, int iloscPasazerow, double gpsL, double gpsW, double pojemnoscLukuCargo)
     : base(id, producent, typ, naped, zasieg, predkoscMaksymalna, iloscPasazerow)
 {
     this.gpsL = gpsL;
     this.gpsW = gpsW;
     this.pojemnoscLukuCargo = pojemnoscLukuCargo;
 }
Example #31
0
        public Spelare(ArgumentFörSpelare parametrar)
        {
            this.EgetTecken  = parametrar.spelarTecken;
            this.Teckenvärde = (int)parametrar.spelarTecken;
            this.Teckenfärg  = parametrar.spelarFärg;
            this.EgenTyp     = parametrar.typ;
            tid = new DateTime().AddMinutes(parametrar.starttid);

            if (parametrar.typ == Typ.MonteCarlo)
            {
                // Parametrarna används när två drag har lika bra statistik
                // INTE när motorn spelar mot sig själv
                this.användAI = new MonteCarloAI((int)this.EgetTecken,
                                                 motståndarminus: 0.1,
                                                 sekundärhotKonstant: 0.01,
                                                 motståndarhotKonstant: 0.001,
                                                 totalaHotKonstant: 0.0001,
                                                 motståndarsekundärKonstant: 0.00001,
                                                 motståndartotalKonstant: 0.000001);
            }
            else if (parametrar.typ == Typ.Originalgangster)
            {
                this.användAI = new OriginalgangsterAI((int)this.EgetTecken,
                                                       0,
                                                       motståndarminus: 0.1,
                                                       sekundärhotKonstant: 0.01,
                                                       motståndarhotKonstant: 0.01);
            }
        }
Example #32
0
 public DataModel(PackageModel package, string name, JsonSchema schema)
 {
     Package = package;
     Name    = name;
     Typ     = Typ.Manual(Package.PackageName, Name);
     _schema = schema;
 }
Example #33
0
        protected override bool ParseCilInstructionInternal(Instruction instruction,
                                                            ProgramState state)
        {
            var fieldReference = instruction.Operand as FieldReference;
            // An object expression for an instance field and a class expression for a static
            // field.
            Expression fieldParentExpression;
            // The expression to set the field to.
            Expression expressionToStore;

            switch (instruction.OpCode.Code)
            {
            case Code.Stfld:
                (expressionToStore, _)     = state.Pop();
                (fieldParentExpression, _) = state.Pop();
                break;

            case Code.Stsfld:
                (expressionToStore, _) = state.Pop();
                fieldParentExpression  = new LvarExpression(
                    new GlobalVariable(fieldReference.DeclaringType.GetCompatibleFullName()));
                break;

            default:
                return(false);
            }
            var fieldStore = new Store(CreateFieldExpression(fieldParentExpression, fieldReference),
                                       expressionToStore,
                                       Typ.FromTypeReferenceNoPointer(fieldReference.DeclaringType),
                                       state.CurrentLocation);
            var node = AddMethodBodyInstructionsToCfg(state, fieldStore);

            state.PushInstruction(instruction.Next, node);
            return(true);
        }
Example #34
0
 public override void CountUses(Typ typ, HashBag <FullCellAddr> numberUses)
 {
     for (int i = 0; i < es.Length; i++)
     {
         es[i].CountUses(GetInputTyp(i), numberUses);
     }
 }
Example #35
0
 public Auto(string nrRej, Typ marka, string model, string kolor, string nrKolor, string opis)
 {
     NrRej = nrRej;
     Marka = marka;
     Model = model;
     Kolor = kolor;
     NrKolor = nrKolor;
     Opis = opis;
 }
Example #36
0
		private  DataCollection<FullUseForTyp> LoadAvailableFullTypForTyp (Typ TypToSearchFor)
			{
			DataCollection<FullUseForTyp> Result = new DataCollection<FullUseForTyp> ();
			foreach (FullUseForTyp Entry in AvailableFullTyp.Values)
				{
				if (Entry.ConnectedID == TypToSearchFor.ID)
					Result.Add(Entry);
				else if (Entry.ConnectedID == TypToSearchFor.RootFormat)
					Result.Add ((Entry));
				}
			return Result;
			}
Example #37
0
 public static bool Write(string fileName, Typ dumpTyp)
 {
     using (var fs = new System.IO.FileStream(fileName, System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.None))
     {
         MiniDumpExceptionInformation exp;
         exp.ThreadId = GetCurrentThreadId();
         exp.ClientPointers = false;
         exp.ExceptioonPointers = System.Runtime.InteropServices.Marshal.GetExceptionPointers();
         bool bRet = MiniDumpWriteDump(
           GetCurrentProcess(),
           GetCurrentProcessId(),
           fs.SafeFileHandle.DangerousGetHandle(),
           (uint)dumpTyp,
           ref exp,
           IntPtr.Zero,
           IntPtr.Zero);
         return bRet;
     }
 }
Example #38
0
        public override Variable NewVar(string name, Typ typ)
        {
            if (Ty.HasMember(name))
            { ErNameDuplication(new Token(name), Ty.Name); }

            return Ty.NewVar(name, typ);
        }
Example #39
0
		public override void CountUses(Typ typ, HashBag<FullCellAddr> numberUses) {
			es[0].CountUses(Typ.Number, numberUses);
			for (int i = 1; i < es.Length; i++) {
				es[i].CountUses(typ, numberUses);
			}
		}
Example #40
0
		public readonly Typ[] argTypes; // null means variadic

		public Signature(Typ retType, params Typ[] argTypes) {
			this.retType = retType;
			this.argTypes = argTypes;
		}
Example #41
0
		public override void CountUses(Typ typ, HashBag<FullCellAddr> numberUses) {
			if (es.Length == 3) {
				es[0].CountUses(Typ.Number, numberUses);
				es[1].CountUses(typ, numberUses);
				es[2].CountUses(typ, numberUses);
			}
		}
Example #42
0
 /// <summary>
 /// Initializes a new instance of the <see cref="pudink.Brouk.Abilities"/> class with bug type.
 /// </summary>
 /// <param name="bug">Bug type.</param>
 public Abilities(Typ bug)
 {
     NastavTyp(bug);
 }
Example #43
0
        public override Variable NewVar(string name, Typ typ)
        {
            foreach (Variable p in prmls)
            {
                if (p.Name == name)
                { ErNameDuplication(new Token(name), ""); }
            }

            Variable v = new Variable(name, typ, Variable.VariableKind.Param);
            prmls.Add(v);
            return v;
        }
Example #44
0
 public static Typ CreateTyp(global::System.Guid ID)
 {
     Typ typ = new Typ();
     typ.ID = ID;
     return typ;
 }
Example #45
0
 public static bool Write(string fileName, Typ dumpTyp = Typ.MiniDumpWithFullMemory)
 {
     using (var fs = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None))
     {
         MiniDumpExceptionInformation exp;
         exp.ThreadId = GetCurrentThreadId();
         exp.ClientPointers = false;
         exp.ExceptioonPointers = Marshal.GetExceptionPointers();
         var bRet = MiniDumpWriteDump(
           GetCurrentProcess(),
           GetCurrentProcessId(),
           fs.SafeFileHandle.DangerousGetHandle(),
           (uint)dumpTyp,
           ref exp,
           IntPtr.Zero,
           IntPtr.Zero);
         return bRet;
     }
 }
Example #46
0
		public override void CountUses(Typ typ, HashBag<FullCellAddr> numberUses) {
			for (int i = 0; i < es.Length; i++) {
				es[i].CountUses(GetInputTyp(i), numberUses);
			}
		}
		//private DataCollection<StandBildMappingFull> _allStandBildMappingFullForDataElementForAllTyp;
		//public DataCollection<StandBildMappingFull> AllStandBildMappingFullForDataElementForAllTyp
		//	{
		//	get
		//		{
		//		if (_allStandBildMappingFullForDataElementForAllTyp == null)
		//			{
		//			_allStandBildMappingFullForDataElementForAllTyp = new DataCollection<StandBildMappingFull>();
		//			LoadAllStandBildMappingFullForDataElement(_allStandBildMappingFullForDataElementForAllTyp,
		//				Profile.ActiveFullDataDependency, null);
		//			}
		//		return _allStandBildMappingFullForDataElementForAllTyp;
		//		}
		//	set { SetProperty(ref _allStandBildMappingFullForDataElementForAllTyp, value); }
		//	}

		//private DataCollection<StandBildMappingFull> _allStandBildMappingFullForDataElementForSelectedTyp;
		//public DataCollection<StandBildMappingFull> AllStandBildMappingFullForDataElementForSelectedTyp
		//	{
		//	get
		//		{
		//		if ((_allStandBildMappingFullForDataElementForSelectedTyp == null)
		//			&& (Profile.ActiveFullDataDependency != null))
		//			{
		//			_allStandBildMappingFullForDataElementForSelectedTyp = new DataCollection<StandBildMappingFull>();
		//			LoadAllStandBildMappingFullForDataElement(_allStandBildMappingFullForDataElementForSelectedTyp,
		//				Profile.ActiveFullDataDependency, Profile.ActiveTyp);
		//			}
		//		return _allStandBildMappingFullForDataElementForSelectedTyp;
		//		}
		//	set { SetProperty(ref _allStandBildMappingFullForDataElementForSelectedTyp, value); }
		//	}

		private void LoadAllStandBildMappingFullForDataElement
			(DataCollection<StandBildMappingFull> Result, FullDataDependency ActuallDTD, Typ ActuallTypToSelect)
			{
			if (ActuallTypToSelect == null)
				{
				foreach (StandBildMappingFull Entry in AllStandBildMappingFull.Values)
					{
					if (Entry.DataElementeTemplatesID != ActuallDTD.DataElementeTemplatesID)
						continue;
					Result.Add (Entry);
					}
				}
			else
				{
				foreach (StandBildMappingFull Entry in CorrectOrderedStandBildMappingFullForTyp)
					{
					if (Entry.DataElementeTemplatesID != ActuallDTD.DataElementeTemplatesID)
						continue;
					Result.Add(Entry);
					}
				}
			}
Example #48
0
		private LocalBuilder localBuilder; // null until var emitted

		public LocalVariable(String name, Typ type)
			: base(name, type) { }
        public DbSyncTypeDiff(Typ typeAin, Typ typeBin)
        {
            this.typeA = typeAin;
            this.typeB = typeBin;

            typeAtributesA = new List<ObjectAtribute>();
            typeAtributesB = new List<ObjectAtribute>();

            if (typeA == null || typeB == null)
            {
                if (typeA != null)
                {
                    typeName = typeA.Nazov;
                    typeAtributesA.Add(new ObjectAtribute("Name of type", typeName, true));
                    typeAtributesA.Add(new ObjectAtribute("Type datatype ", typeA.Datatyp, true));
                    typeAtributesA.Add(new ObjectAtribute("Type precision ", typeA.Precision, true));
                    typeAtributesA.Add(new ObjectAtribute("Type scale ", typeA.Scale, true));
                    typeAtributesA.Add(new ObjectAtribute("Type Is Nullable ", typeA.CanBeNull.ToString(), true));
                }
                else if (typeB != null)
                {
                    typeName = typeB.Nazov;
                    typeAtributesB.Add(new ObjectAtribute("Name of type", typeName, true));
                    typeAtributesA.Add(new ObjectAtribute("Type datatype ", typeB.Datatyp, true));
                    typeAtributesA.Add(new ObjectAtribute("Type precision ", typeB.Precision, true));
                    typeAtributesA.Add(new ObjectAtribute("Type scale ", typeB.Scale, true));
                    typeAtributesA.Add(new ObjectAtribute("Type Is Nullable ", typeB.CanBeNull.ToString(), true));
                }
                else typeName = "UNDEFINED";
            }
            if (typeA != null && typeB != null)
            {
                if (typeA.Datatyp != typeB.Datatyp) diffTypeDatatype = true;
                if (typeA.Precision != typeB.Precision) diffPrecision = true;
                if (typeA.Scale != typeB.Scale) diffScale = true;
                if (typeA.CanBeNull != typeB.CanBeNull) diffCanBeNull = true;
                if (typeA.Nazov != typeB.Nazov) diffTypeNAme = true;

                if (diffPrecision || diffScale || diffTypeDatatype || diffTypeNAme || diffCanBeNull) different = true;
                else different = false;

                typeName = typeA.Nazov;
                typeAtributesA.Add (new ObjectAtribute("Name of type",typeName,false));
                typeAtributesB.Add (new ObjectAtribute("Name of type",typeName,false));

                if (diffPrecision)
                {
                    ObjectAtribute tcharA = new ObjectAtribute("Type precision ", typeA.Precision, true);
                    typeAtributesA.Add(tcharA);
                    ObjectAtribute tcharB = new ObjectAtribute("Type precision  ", typeB.Precision, true);
                    typeAtributesB.Add(tcharB);
                }
                else
                {
                    ObjectAtribute tchar = new ObjectAtribute("Type precision  ", typeA.Precision, false);
                    typeAtributesA.Add(tchar);
                    typeAtributesB.Add(tchar);
                }

                if (diffScale)
                {
                    ObjectAtribute tcharA = new ObjectAtribute("Type scale  ", typeA.Scale, true);
                    typeAtributesA.Add(tcharA);
                    ObjectAtribute tcharB = new ObjectAtribute("Type scale   ", typeB.Scale, true);
                    typeAtributesB.Add(tcharB);
                }
                else
                {
                    ObjectAtribute tchar = new ObjectAtribute("Type scale   ", typeA.Scale, false);
                    typeAtributesA.Add(tchar);
                    typeAtributesB.Add(tchar);
                }

                if (diffTypeDatatype)
                {
                    ObjectAtribute tcharA = new ObjectAtribute("Datatype ", typeA.Datatyp, true);
                    typeAtributesA.Add(tcharA);
                    ObjectAtribute tcharB = new ObjectAtribute("Datatype ", typeB.Datatyp, true);
                    typeAtributesB.Add(tcharB);
                }
                else
                {
                    ObjectAtribute tchar = new ObjectAtribute("Datatype  ", typeA.Datatyp, false);
                    typeAtributesA.Add(tchar);
                    typeAtributesB.Add(tchar);
                }

                if (diffCanBeNull)
                {
                    ObjectAtribute tcharA = new ObjectAtribute("Type Is Nullable ", typeA.CanBeNull.ToString(), true);
                    typeAtributesA.Add(tcharA);
                    ObjectAtribute tcharB = new ObjectAtribute("Type Is Nullable ", typeB.CanBeNull.ToString(), true);
                    typeAtributesB.Add(tcharB);
                }
                else
                {
                    ObjectAtribute tchar = new ObjectAtribute("Type Is Nullable  ", typeA.CanBeNull.ToString(), false);
                    typeAtributesA.Add(tchar);
                    typeAtributesB.Add(tchar);
                }

            }
            else different = true;
        }
Example #50
0
		public LocalArgument(String name, Typ type, short argumentNumber)
			: base(name, type) { this.argumentNumber = argumentNumber; }
Example #51
0
		public void CountUses(Typ typ, HashBag<FullCellAddr> numberUses) {
			expr.CountUses(typ, numberUses);
			if (evalCond != null) {
				evalCond.CountUses(Typ.Number, numberUses);
			}
		}
Example #52
0
 public void AddToTyp(Typ typ)
 {
     base.AddObject("Typ", typ);
 }
Example #53
0
 /// <summary>
 /// Sets pudding to specified type.
 /// </summary>
 /// <param name="data">Type.</param>
 public void NastavTyp(Typ data)
 {
     switch(data)
     {
     case Typ.Boss:
         Vse = true;
         return;
     case Typ.Lava:
         Move = true;
         return;
     case Typ.Normal:
         Move = true;
         Jump = true;
         return;
     case Typ.Shooting:
         Vse = false;
         Shoot = true;
         return;
     }
 }
Example #54
0
		/// <summary>
		/// Compute least upper bound of two types in the Typ type lattice.
		/// </summary>
		/// <returns>The least upper bound of the two argument types.</returns>
		protected Typ Lub(Typ typ1, Typ typ2) {
			if (typ1 == typ2) {
				return typ1;
			}
			else {
				switch (typ1) {
					case Typ.Error:
						return typ2;
					case Typ.Number:
					case Typ.Text:
					case Typ.Array:
					case Typ.Function:
						return typ2 == Typ.Error ? typ1 : Typ.Value;
					case Typ.Value:
						return Typ.Value;
					default:
						throw new ImpossibleException("Lub(Typ, Typ)");
				}
			}
		}
Example #55
0
 /// <summary>
 /// Sets attack force and lifes variables.
 /// </summary>
 /// <param name="data">Type</param>
 public void NastavTyp(Typ data)
 {
     switch (data)
     {
     case Typ.Boss:
         Poskozeni = 1.5f;
         Zivoty = 20;
         return;
     case Typ.Lava:
         Poskozeni = 1;
         Zivoty = 3;
         return;
     case Typ.Normal:
         Poskozeni = 0.5f;
         Zivoty = 3;
         return;
     case Typ.Shooting:
         Poskozeni = 0.75f;
         Zivoty = 4;
         return;
     }
 }
Example #56
0
		public override void CountUses(Typ typ, HashBag<FullCellAddr> numberUses) { }
 public abstract string createType(Typ typIn);
Example #58
0
		public DataCollection<StandBildMapping> GetCorrectOrderedStandBildMappingForActiveTypAndRedaktion
			(Typ activeTyp, String activeRedaktion)
			{
			DataCollection<StandBildMapping> UnsortedOrderedStandBildMappingForActiveTypAndRedaktion =
						new DataCollection<StandBildMapping> ();
			LoadAvailableMappingEntriesForType(UnsortedOrderedStandBildMappingForActiveTypAndRedaktion,
							(Guid)activeTyp.ID, activeRedaktion);
			return  new DataCollection<StandBildMapping> 
						(UnsortedOrderedStandBildMappingForActiveTypAndRedaktion
						.OrderBy (Entry => Entry.ProcessingOrder));
			}
Example #59
0
		public override void CountUses(Typ typ, HashBag<FullCellAddr> numberUses) {
			foreach (CGExpr e in es) {
				e.CountUses(Typ.Number, numberUses);
			}
		}
 public abstract List<string> alterType(Typ typeIn);