Esempio n. 1
0
 public WSNetwork(String rName,
                  ResearchType rType,
                  GenerationType gType,
                  TracingType tType,
                  Dictionary <ResearchParameter, Object> rParams,
                  Dictionary <GenerationParameter, Object> genParams,
                  AnalyzeOption analyzeOpts) : base(rName, rType, gType, tType, rParams, genParams, analyzeOpts)
 {
     networkGenerator = new WSNetworkGenerator();
     networkAnalyzer  = new NonHierarchicAnalyzer(this);
 }
Esempio n. 2
0
 /// <summary>
 /// Sets tracing type for specified research.
 /// </summary>
 /// <param name="id">ID of research.</param>
 /// <param name="tracingType">Tracing type to set.</param>
 public static void SetResearchTracingType(Guid id, TracingType tracingType)
 {
     try
     {
         existingResearches[id].TracingType = tracingType;
     }
     catch (KeyNotFoundException)
     {
         throw new CoreException("Specified research does not exists.");
     }
 }
Esempio n. 3
0
        public AbstractNetwork(String rName, ResearchType rType,
                               GenerationType gType, TracingType tType,
                               Dictionary <ResearchParameter, Object> rParams,
                               Dictionary <GenerationParameter, Object> genParams,
                               AnalyzeOption AnalyzeOptions)
        {
            ResearchName              = rName;
            ResearchType              = rType;
            GenerationType            = gType;
            TracingType               = tType;
            ResearchParameterValues   = rParams;
            GenerationParameterValues = genParams;
            this.AnalyzeOptions       = AnalyzeOptions;

            NetworkResult = new RealizationResult();
        }
Esempio n. 4
0
        /// <summary>
        /// Creates a research and adds to existingResearches.
        /// </summary>
        /// <param name="researchType">The type of research to create.</param>
        /// <param name="modelType">The model type of research to create.</param>
        /// <param name="researchName">The name of research.</param>
        /// <param name="storage">The storage type for saving results of analyze.</param>
        /// <param name="storageString">Connection string or file path for data storage.</param>
        /// <param name="tracingPath">Path, if tracing is on, and empty string otherwise.</param>
        /// <param name="checkConnected">Specifies if check for network's connected is on.</param>
        /// <returns>ID of created Research.</returns>
        public static Guid CreateResearch(ResearchType researchType,
                                          ModelType modelType,
                                          string researchName,
                                          StorageType storage,
                                          string storageString,
                                          GenerationType generationType,
                                          string tracingPath,
                                          TracingType tracingType,
                                          bool checkConnected)
        {
            AbstractResearch r = AbstractResearch.CreateResearchByType(researchType);

            existingResearches.Add(r.ResearchID, r);
            r.ModelType      = modelType;
            r.ResearchName   = researchName;
            r.Storage        = AbstractResultStorage.CreateStorage(storage, storageString);
            r.GenerationType = generationType;
            r.TracingPath    = tracingPath;
            r.TracingType    = tracingType;
            r.CheckConnected = checkConnected;

            return(r.ResearchID);
        }
Esempio n. 5
0
        static RandNetSettings()
        {
            config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

            try
            {
                loggingDirectory = config.AppSettings.Settings["LoggingDirectory"].Value;
                storageDirectory = config.AppSettings.Settings["StorageDirectory"].Value;
                //connectionString = config.ConnectionStrings.ConnectionStrings[config.AppSettings.Settings["SQLProvider"].Value].ConnectionString;
                tracingDirectory = config.AppSettings.Settings["TracingDirectory"].Value;
                tracingType      = (TracingType)Enum.Parse(typeof(TracingType),
                                                           config.AppSettings.Settings["Tracingtype"].Value);
                workingMode = (ManagerType)Enum.Parse(typeof(ManagerType),
                                                      config.AppSettings.Settings["WorkingMode"].Value);
                staticGenerationDirectory     = config.AppSettings.Settings["StaticGenerationDirectory"].Value;
                matrixConvertionToolDirectory = config.AppSettings.Settings["MatrixConvertionToolDirectory"].Value;
                modelCheckingToolDirectory    = config.AppSettings.Settings["ModelCheckingToolDirectory"].Value;
                dataConvertionToolDirectory   = config.AppSettings.Settings["DataConvertionToolDirectory"].Value;
            }
            catch
            {
                throw new CoreException("The structure of Configuration file is not correct.");
            }
        }
Esempio n. 6
0
        public static AbstractNetwork CreateNetworkByType(ModelType mt, String rName,
                                                          ResearchType rType, GenerationType gType, TracingType tType,
                                                          Dictionary <ResearchParameter, Object> rParams,
                                                          Dictionary <GenerationParameter, Object> genParams,
                                                          AnalyzeOption AnalyzeOptions)
        {
            ModelTypeInfo[] info = (ModelTypeInfo[])mt.GetType().GetField(mt.ToString()).GetCustomAttributes(typeof(ModelTypeInfo), false);
            Type            t    = Type.GetType(info[0].Implementation);

            Type[] constructTypes = new Type[] {
                typeof(String),
                typeof(ResearchType),
                typeof(GenerationType),
                typeof(TracingType),
                typeof(Dictionary <ResearchParameter, Object>),
                typeof(Dictionary <GenerationParameter, Object>),
                typeof(AnalyzeOption)
            };
            Object[] invokeParams = new Object[] {
                rName,
                rType,
                gType,
                tType,
                rParams,
                genParams,
                AnalyzeOptions
            };
            return((AbstractNetwork)t.GetConstructor(constructTypes).Invoke(invokeParams));
        }