/// <summary>
 /// Initializes a new s_instance of the <see cref="IOItemDefinition"/> class.
 /// </summary>
 /// <param name="name">The name of input item.</param>
 /// <param name="type">The type of input item.</param>
 /// <param name="description">The description.</param>
 public IOItemDefinition(string name, string type, string description, TraceLabSDK.IOSpecType ioType)
 {
     Name = name;
     Type = type;
     Description = description;
     IOType = ioType;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="LineSeriesDTO"/> class
 /// based on original line series coming from the user data.
 /// </summary>
 /// <param name="lineSeries">The line series.</param>
 public LineSeriesDTO(TraceLabSDK.Types.Contests.LineSeries lineSeries)
 {
     m_metricName = lineSeries.MetricName;
     m_points = new List<PointDTO>();
     foreach (TraceLabSDK.Types.Contests.Point point in lineSeries.Points)
     {
         m_points.Add(new PointDTO(point.X, point.Y));
     }
 }
 internal static TraceLabSDK.Types.Contests.DatasetResults CreateDummyDatasetResults(string datasetName, 
                                                  TraceLabSDK.Types.Contests.LineSeries lineSeriesMetric, 
                                                  TraceLabSDK.Types.Contests.BoxSummaryData boxSummaryMetric)
 {
     var datasetResults = new TraceLabSDK.Types.Contests.DatasetResults(datasetName);
     datasetResults.AddBoxSummaryMetric(boxSummaryMetric);
     datasetResults.AddLineSeriesMetric(lineSeriesMetric);
     return datasetResults;
 }
 public BoxPlotPointDTO(TraceLabSDK.Types.Contests.BoxPlotPoint boxPlotPoint)
 {
     Min = boxPlotPoint.Min;
     Q1 = boxPlotPoint.Q1;
     Median = boxPlotPoint.Median;
     Mean = boxPlotPoint.Mean;
     Q3 = boxPlotPoint.Q3;
     Max = boxPlotPoint.Max;
     StdDev = boxPlotPoint.StdDev;
     N = boxPlotPoint.N;
 }
        public static ContestResults PrepareBaselineContestRestults(string contestId, 
                                TraceLabSDK.Types.Contests.TLExperimentResults experimentResults,
                                string techniqueName,                    
                                string techniqueDescription)
        {
            List<DatasetResultsDTO> results = new List<DatasetResultsDTO>();
            foreach (TraceLabSDK.Types.Contests.DatasetResults dataset in experimentResults.DatasetsResults)
            {
                results.Add(new DatasetResultsDTO(dataset));
            }

            var baselineResults = new ContestResults(contestId, techniqueName, techniqueDescription, results, experimentResults.Score, experimentResults.BaseData);
            return baselineResults;
        }
        public MetricDefinition(TraceLabSDK.Types.Contests.Metric metric)
        {
            Name = metric.MetricName;
            Description = metric.Description;

            if(metric.GetType().Equals(typeof(TraceLabSDK.Types.Contests.LineSeries))) 
            {
                MetricType = typeof(LineSeriesDTO).Name;
            }
            else if (metric.GetType().Equals(typeof(TraceLabSDK.Types.Contests.BoxSummaryData)))
            {
                MetricType = typeof(BoxSummaryDataDTO).Name;
            }
            else
            {
                throw new ArgumentException("Provided metric is not of valid type. Only LineSeries and BoxSummaryData from TraceLabSDK are allowed.");
            }
        }
        public static void ExtractDatasetsAndMetricsDefinitions(TraceLabSDK.Types.Contests.TLExperimentResults experimentResults,
                                                                out List<MetricDefinition> metrics, out List<string> datasets)
        {
            datasets = new List<string>();
            metrics = new List<MetricDefinition>();

            foreach (TraceLabSDK.Types.Contests.DatasetResults dataset in experimentResults.DatasetsResults)
            {
                datasets.Add(dataset.DatasetName);

                //if metrics has not been yet assigned
                if (metrics.Count == 0)
                {
                    //iterate through first dataset for all metrics 
                    //(assumption is that all datasets are using the same metrics
                    foreach (TraceLabSDK.Types.Contests.Metric metric in dataset.Metrics)
                    {
                        metrics.Add(new MetricDefinition(metric));
                    }
                }
            }
        }
 public DatasetResultsDTO(TraceLabSDK.Types.Contests.DatasetResults datasetResult)
 {
     m_datasetName = datasetResult.DatasetName;
     m_metrics = new List<IMetricResult>();
     foreach (TraceLabSDK.Types.Contests.Metric metric in datasetResult.Metrics)
     {
         var boxSummaryMetric = metric as TraceLabSDK.Types.Contests.BoxSummaryData;
         var lineSeriesMetric = metric as TraceLabSDK.Types.Contests.LineSeries;
         
         if (boxSummaryMetric != null)
         {
             m_metrics.Add(new BoxSummaryDataDTO(boxSummaryMetric));
         }
         else if (lineSeriesMetric != null)
         {
             m_metrics.Add(new LineSeriesDTO(lineSeriesMetric));
         }
         else
         {
             throw new InvalidOperationException("Experiment results cannot have any metrics that are not compatible with TraceLabSDK.Types.Contests.LineSeries, or TraceLabSDK.Types.Contests.BoxSummaryData");
         }
     }
 }
 protected override void CreateImporter(TraceLabSDK.ComponentLogger logger)
 {
     TestComponent = new PreprocessorStemmerComponent(logger);
 }
 public RunnableComponentNode(String id, String label, IComponent component, TraceLabSDK.ComponentLogger logger, ComponentsLibrary library, bool waitForAllPredecessors) 
     : base(id, label, new RunnableNodeCollection(), new RunnableNodeCollection(), library, waitForAllPredecessors)
 {
     m_component = component;
     Logger = logger;
 }
 public CLVReferenceNode(TraceLabSDK.PackageSystem.IPackageReference reference)
 {
     m_reference = reference;
     Exists = TraceLab.Core.PackageSystem.PackageManager.Instance.Contains(reference);
 }
 public PackageReference(TraceLabSDK.PackageSystem.IPackage package)
 {
     ID = package.ID;
     Name = package.Name;
 }
 public void RunExperiment(TraceLabSDK.IProgress progress, TraceLab.Core.Workspaces.Workspace workspace, ComponentsLibrary library)
 {
     m_experiment.RunExperiment(progress, workspace, library);
 }
 protected override void CreateImporter(TraceLabSDK.ComponentLogger logger)
 {
     TestComponent = new TracerComponent(logger);
 }
示例#15
0
        public PackageFileInfo(TraceLabSDK.Component.Config.BasePath filePath)
        {
            //1. First record current absolute path to real file -> this file is going to be added to package
            m_absoluteLocation = Path.GetFullPath(filePath.Absolute);

            // HERZUM SPRINT 2.6 TLAB-82
            if (filePath.Relative!=null)
            // HERZUM SPRINT 2.6 TLAB-82

            //2. Determine new relative directory by eliminating '../../' -> it has to be subdirectory, so we can add it to the package.
            m_relativeLocation = DetermineRelativePathToSubDir(filePath.Relative, out m_foldersPath);
        }
示例#16
0
        /// <summary>
        /// Displays the GTK window.
        /// </summary>
        /// <param name="editor">The editor.</param>
        /// <param name="windowTitle">The window title.</param>
        /// <returns>if window has been displayed, otherwise false</returns>
        private bool DisplayGTKWindow(TraceLabSDK.IWorkspaceUnitEditor editor, String windowTitle)
        {
            DockItem dockingWindow = m_dockFrame.GetItem(windowTitle);
            if(dockingWindow == null) 
            {
                dockingWindow = m_dockFrame.AddItem(windowTitle);
                dockingWindow.DefaultLocation = "Workspace/Bottom";
                dockingWindow.Behavior = DockItemBehavior.Normal;

                dockingWindow.Visible = true;

                //Float window
                m_dockFrame.SetStatus(dockingWindow, DockItemStatus.Floating);
                Gdk.Rectangle floatRectangle = dockingWindow.FloatingPosition;
                floatRectangle.Width = 350;
                floatRectangle.Height = 180;

                //location of info box next to the component node just sligthly below cursor click
                floatRectangle.X = 150;
                floatRectangle.Y = 150;
                dockingWindow.SetFloatMode(floatRectangle);
            } 
            else
            {
                //if already exists just set it visible
                dockingWindow.Visible = true;
            }

            dockingWindow.Label = windowTitle;
            dockingWindow.Content = editor as Widget;

            return true;
        }
 protected override void CreateImporter(TraceLabSDK.ComponentLogger logger)
 {
     TestImporter = new PoirotXMLImporter(logger);
 }
示例#18
0
        private static string ReferenceTypesAssemblies(List<string> typeDirectories, TraceLabSDK.ComponentLogger logger, out HashSet<string> assembliesReferenceLocations)
        {
            string usingKeyword = "using ";
            string semicolon = ";";

            Dictionary<string, System.Reflection.Assembly> assemblies = new Dictionary<string, System.Reflection.Assembly>();
            foreach (System.Reflection.Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                var name = assembly.GetName();
                assemblies[name.Name + System.Text.UTF8Encoding.UTF8.GetString(name.GetPublicKeyToken())] = assembly;
            }

            assembliesReferenceLocations = new HashSet<string>();
            HashSet<string> namespaces = new HashSet<string>();
            StringBuilder typesNamespaces = new StringBuilder();

            //preadd fixed namespaces
            namespaces.Add("System");
            namespaces.Add("System.Security.Permissions");
            namespaces.Add("TraceLab.Core.ExperimentExecution");
            namespaces.Add("TraceLab.Core.Experiments");
            namespaces.Add("TraceLab.Core.Decisions");
            namespaces.Add("TraceLabSDK");
            foreach (string fixedNamespace in namespaces)
            {
                typesNamespaces.AppendLine(usingKeyword + fixedNamespace + semicolon);
            }

            //iterate through all type directories, search for all dll, and collect the namespaces of all found types in those assemblies
            foreach (string dir in typeDirectories)
            {
                string typesDir = System.IO.Path.GetFullPath(dir);

                var files = System.IO.Directory.GetFiles(typesDir, "*.dll");
                foreach (string file in files)
                {
                    var name = System.Reflection.AssemblyName.GetAssemblyName(file);
                    var lookup = name.Name + System.Text.UTF8Encoding.UTF8.GetString(name.GetPublicKeyToken());
                    if (assemblies.ContainsKey(lookup))
                    {
                        var assembly = assemblies[lookup];

                        try
                        {
                            Type[] typesInAssembly = assembly.GetTypes();

                            foreach (Type type in typesInAssembly)
                            {
                                if (namespaces.Contains(type.Namespace) == false && type.Namespace != String.Empty && type.Namespace != null)
                                {
                                    namespaces.Add(type.Namespace);
                                    typesNamespaces.AppendLine(usingKeyword + NamespaceFix(type.Namespace) + semicolon);
                                }
                            }

                            //collect also assemblies location - the assemblies must be added to the compiler parameters
                            assembliesReferenceLocations.Add(assembly.Location);
                        }
                        catch (ReflectionTypeLoadException ex)
                        {
                            if (logger != null)
                            {
                                //log warnings
                                logger.Warn(String.Format("Assembly {0} has been skipped in decision node compilation, because compiler was unable to load one or more of the requested types when compiling decision node. " +
                                                                             "See the Loader Exceptions for more information.", name), ex);
                                int i = 1;
                                foreach (Exception loaderException in ex.LoaderExceptions)
                                {
                                    logger.Warn(String.Format("Loader exception {0}: {1}", i++, loaderException.Message));
                                }
                            }
                        }

                    }
                }
            }

            return typesNamespaces.ToString();
        }