Example #1
0
        static void Main(string[] args)
        {
            string p1 = "AG(p)";
            string p2 = "AG(AG<5(p) => q)";;
            string p3 = "AG(p => AF<7(q))";
            string p4 = "AG(p => A(q W<5 r))";;
            string p5 = "AG(AG<6(p) => A(q U<5 r))";

            ISystemSpecification   tctlSpecification = new SystemSpecification("TCTL");
            IPropertySpecification propertySpecification;

            /*propertySpecification = new PropertySpecification("p1", p1, "");
             * tctlSpecification.addOrReplaceProperty(propertySpecification);
             * propertySpecification = new PropertySpecification("p2", p2, "");
             * tctlSpecification.addOrReplaceProperty(propertySpecification);
             * propertySpecification = new PropertySpecification("p3", p3, "");
             * tctlSpecification.addOrReplaceProperty(propertySpecification);
             */
            propertySpecification = new PropertySpecification("p4", p4, "");
            tctlSpecification.addOrReplaceProperty(propertySpecification);
            propertySpecification = new PropertySpecification("p5", p5, "");
            tctlSpecification.addOrReplaceProperty(propertySpecification);


            /*
             * string pattern = "AG(AG<6(p{0}) => A(q{0} U<5 r{0}))";
             * for (int i = 1; i <= 10000; i++) {
             *  propertySpecification = new PropertySpecification(string.Format("p{0}", i), string.Format(pattern, i), "");
             *  tctlSpecification.addOrReplaceProperty(propertySpecification);
             * }
             */

            var watch = System.Diagnostics.Stopwatch.StartNew();
            ISystemTransformer smtLibTransformer = new SMTLibSystemTransformer();
            ITransformedSystemSpecification transformedSystemSpecification = smtLibTransformer.transform(tctlSpecification);

            watch.Stop();
            System.Diagnostics.Debug.WriteLine(watch.ElapsedMilliseconds / 1000);

            /*foreach (var prop in transformedSystemSpecification.getProperties()) {
             *  System.Diagnostics.Debug.WriteLine(prop.getProperty());
             * }*/

            System.Diagnostics.Debug.WriteLine("test");
        }
Example #2
0
        public static INamespace CreateMediaStoreRepository(Uri uri)
        {
            var mediaStoreL1 = new Repository()
            {
                Name = "Repository", Uri = uri, Prefix = "repo"
            };

            var iAudioStore = new Interface()
            {
                Name = "AudioStoreInterface"
            };

            mediaStoreL1.Interfaces.Add(iAudioStore);

            var iEncoder = new Interface()
            {
                Name = "EncoderInterface"
            };

            mediaStoreL1.Interfaces.Add(iEncoder);

            var iAudioDB = new Interface()
            {
                Name = "AudioDBInterface"
            };

            mediaStoreL1.Interfaces.Add(iAudioDB);

            var iUserManagement = new Interface()
            {
                Name = "UserManagementInterface"
            };

            mediaStoreL1.Interfaces.Add(iUserManagement);

            var iUserDB = new Interface()
            {
                Name = "UserDBInterface"
            };

            mediaStoreL1.Interfaces.Add(iUserDB);

            var iCommand = new Interface()
            {
                Name = "CommandInterface"
            };

            mediaStoreL1.Interfaces.Add(iCommand);

            var iConnection = new Interface()
            {
                Name = "ConnectionInterface"
            };

            mediaStoreL1.Interfaces.Add(iConnection);

            var iDataReaderInterface = new Interface()
            {
                Name = "DataReaderInterface"
            };

            mediaStoreL1.Interfaces.Add(iDataReaderInterface);

            var http = new Interface()
            {
                Name = "HTTP"
            };

            mediaStoreL1.Interfaces.Add(http);

            var webBrowser = new ComponentType()
            {
                Name = "WebBrowser"
            };

            webBrowser.RequiredInterfaces.Add(new RequiredInterface()
            {
                Name      = "backend",
                Interface = http
            });
            mediaStoreL1.ComponentTypes.Add(webBrowser);

            var webForm = new ComponentType()
            {
                Name = "WebForm"
            };

            webForm.ProvidedInterfaces.Add(http);
            webForm.RequiredInterfaces.Add(new RequiredInterface()
            {
                Name      = "application",
                Interface = iAudioStore
            });
            mediaStoreL1.ComponentTypes.Add(webForm);

            var audioStore = new ComponentType()
            {
                Name = "AudioStore"
            };

            audioStore.ProvidedInterfaces.Add(iAudioStore);
            audioStore.RequiredInterfaces.Add(new RequiredInterface()
            {
                Name      = "audioDB",
                Interface = iAudioDB
            });
            audioStore.RequiredInterfaces.Add(new RequiredInterface()
            {
                Name      = "userManagement",
                Interface = iUserManagement
            });
            mediaStoreL1.ComponentTypes.Add(audioStore);

            var encodingAdapter = new ComponentType()
            {
                Name = "EncodingAdapter"
            };

            encodingAdapter.ProvidedInterfaces.Add(iAudioDB);
            encodingAdapter.RequiredInterfaces.Add(new RequiredInterface()
            {
                Name      = "encoder",
                Interface = iEncoder
            });
            encodingAdapter.RequiredInterfaces.Add(new RequiredInterface()
            {
                Name      = "database",
                Interface = iAudioDB
            });
            mediaStoreL1.ComponentTypes.Add(encodingAdapter);

            var oggEncoder = new ComponentType()
            {
                Name = "OggEncoder"
            };

            oggEncoder.ProvidedInterfaces.Add(iEncoder);
            mediaStoreL1.ComponentTypes.Add(oggEncoder);

            var userMgmt = new ComponentType()
            {
                Name = "UserManagement"
            };

            userMgmt.ProvidedInterfaces.Add(iUserManagement);
            userMgmt.RequiredInterfaces.Add(new RequiredInterface()
            {
                Name      = "database",
                Interface = iUserDB
            });
            mediaStoreL1.ComponentTypes.Add(userMgmt);

            var dbadapter = new ComponentType()
            {
                Name = "DBAdapter"
            };

            dbadapter.ProvidedInterfaces.Add(iUserDB);
            dbadapter.ProvidedInterfaces.Add(iAudioDB);
            dbadapter.RequiredInterfaces.Add(new RequiredInterface()
            {
                Name      = "command",
                Interface = iCommand
            });
            dbadapter.RequiredInterfaces.Add(new RequiredInterface()
            {
                Name      = "connection",
                Interface = iConnection
            });
            dbadapter.RequiredInterfaces.Add(new RequiredInterface()
            {
                Name      = "dataReader",
                Interface = iDataReaderInterface
            });
            mediaStoreL1.ComponentTypes.Add(dbadapter);

            var database = new ComponentType()
            {
                Name = "MySqlClient"
            };

            database.ProvidedInterfaces.Add(iCommand);
            database.ProvidedInterfaces.Add(iConnection);
            database.ProvidedInterfaces.Add(iDataReaderInterface);
            mediaStoreL1.ComponentTypes.Add(database);

            var encrypt = new Signature()
            {
                Name = "Encrypt"
            };
            var decrypt = new Signature()
            {
                Name = "Decrypt"
            };

            iEncoder.Signatures.Add(encrypt);
            iEncoder.Signatures.Add(decrypt);

            var upload = new Signature()
            {
                Name = "Upload"
            };
            var download = new Signature()
            {
                Name = "Download"
            };

            iAudioStore.Signatures.Add(upload);
            iAudioStore.Signatures.Add(download);

            oggEncoder.Services.Add(new Service()
            {
                Name       = "Encrypt",
                Implements = encrypt
            });
            oggEncoder.Services.Add(new Service()
            {
                Name       = "Decrypt",
                Implements = decrypt
            });

            audioStore.Services.Add(new Service()
            {
                Name       = "Upload",
                Implements = upload
            });
            audioStore.Services.Add(new Service()
            {
                Name       = "Download",
                Implements = download
            });

            var mediaStoreSystem = new SystemSpecification()
            {
                Name = "MediaStoreSystem"
            };

            mediaStoreSystem.PublicInterfaces.Add(new RequiredInterface()
            {
                Name      = "Frontend",
                Interface = http
            });
            mediaStoreL1.SystemSpecifications.Add(mediaStoreSystem);

            return(mediaStoreL1);
        }