/// <summary> /// Validates the entire experiment. /// It validates the structure of the experimental graph, /// validates all inputs and outputs, /// checks if all components are in the component library. /// </summary> /// <param name="experiment">The experiment.</param> /// <param name="vertices">The vertices, that has been parsed from the start node. Nodes that are not connected to the start are being skipped.</param> /// <param name="edges">The edges, that has been parsed from the start node.</param> /// <returns> /// true if there is no errors, false, if errors has been detected /// </returns> public static bool ValidateExperiment(IExperiment experiment, out List <ExperimentNode> vertices, out List <ExperimentNodeConnection> edges, List <string> workspaceTypesDirectories, bool validateInputMapping, LoggerNameRoot loggerNameRoot) { bool noErrors = GraphValidator.Validate(experiment, out vertices, out edges); if (noErrors) { var availableInputMappingsPerNode = new TraceLab.Core.Utilities.InputMappings(experiment); if (validateInputMapping) { noErrors = InputMappingValidator.Validate(experiment, availableInputMappingsPerNode); } if (noErrors) { //recompile all decisions noErrors = TraceLab.Core.Decisions.DecisionCompilationRunner.CompileAllDecisionNodes(experiment, availableInputMappingsPerNode, workspaceTypesDirectories, loggerNameRoot); } } if (noErrors) { noErrors = ValidComponents(vertices); } return(noErrors); }
private void fillLoadComboBox() { clearComboBox(); ExperimentNode currentNode = LoopNodeControl.ExperimentNode; Dictionary <string, string> predeccessorsOutputsNameTypeLookup; // TLAB-174: we use the Owner instead of the application experiment to get only variables the scope can access //var availableInputMappingsPerNode = new TraceLab.Core.Utilities.InputMappings (m_applicationContext.Application.Experiment); var availableInputMappingsPerNode = new TraceLab.Core.Utilities.InputMappings(m_loopControl.ExperimentNode.Owner); if (availableInputMappingsPerNode.TryGetValue(currentNode, out predeccessorsOutputsNameTypeLookup) == false) { predeccessorsOutputsNameTypeLookup = new Dictionary <string, string> (); //return empty - there is not path from start node to decision } String wrapper = "Load(\""; this.loadComboBox.AppendText(LOAD_A_VALUE); foreach (string workspaceUnitName in predeccessorsOutputsNameTypeLookup.Keys) { this.loadComboBox.AppendText(wrapper + workspaceUnitName + "\")"); } setActiveComboBoxValue(loadComboBox, LOAD_A_VALUE); }
/// <summary> /// Validates the entire experiment. /// It validates the structure of the experimental graph, /// validates all inputs and outputs, /// checks if all components are in the component library. /// </summary> /// <param name="experiment">The experiment.</param> /// <param name="vertices">The vertices, that has been parsed from the start node. Nodes that are not connected to the start are being skipped.</param> /// <param name="edges">The edges, that has been parsed from the start node.</param> /// <returns> /// true if there is no errors, false, if errors has been detected /// </returns> public static bool ValidateExperiment(IExperiment experiment, out List<ExperimentNode> vertices, out List<ExperimentNodeConnection> edges, List<string> workspaceTypesDirectories, bool validateInputMapping, LoggerNameRoot loggerNameRoot) { bool noErrors = GraphValidator.Validate(experiment, out vertices, out edges); if (noErrors) { var availableInputMappingsPerNode = new TraceLab.Core.Utilities.InputMappings(experiment); if (validateInputMapping) { noErrors = InputMappingValidator.Validate(experiment, availableInputMappingsPerNode); } if (noErrors) { //recompile all decisions noErrors = TraceLab.Core.Decisions.DecisionCompilationRunner.CompileAllDecisionNodes(experiment, availableInputMappingsPerNode, workspaceTypesDirectories, loggerNameRoot); } } if (noErrors) { noErrors = ValidComponents(vertices); } return noErrors; }
void Refresh() { List<string> entries = new List<string>(); if (DataContext is KeyValuePair<string, IOItem>) { KeyValuePair<string, IOItem> keyValuePair = (KeyValuePair<string, IOItem>)DataContext; IOItem currentItem = keyValuePair.Value; var infoControl = TemplatedParent.GetParent<NodeInfoContainer>(null); var control = infoControl != null ? infoControl.OriginElement : null; if (control != null) { // We'll need to query the canvas for links //NodeGraphLayout canvas = control.RootCanvas as NodeGraphLayout; TraceLab.UI.WPF.Views.DockableGraph topGraph = control.GetParent<TraceLab.UI.WPF.Views.DockableGraph>(null); NodeGraphLayout canvas = topGraph.graphLayout; // Add the current mapping entries.Add(currentItem.MappedTo); // Get the current item's type so that we can limit the selection to only this type string currentType = currentItem.IOItemDefinition.Type; var availableInputMappingsPerNode = new TraceLab.Core.Utilities.InputMappings(canvas.Graph); ExperimentNode currentNode = control.Vertex as ExperimentNode; //if currentNode is a ExperimentNode, and is ioValidator has incoming outputs for this node (otherwise, it has not been connected to start node) if (currentNode != null && availableInputMappingsPerNode.ContainsMappingsForNode(currentNode)) { foreach (string incomingOutput in availableInputMappingsPerNode[currentNode].Keys) { if (string.Equals(currentType, availableInputMappingsPerNode[currentNode][incomingOutput])) { entries.Add(incomingOutput); } } } } } this.ItemsSource = entries.Distinct(); }
void Refresh() { List <string> entries = new List <string>(); if (DataContext is KeyValuePair <string, IOItem> ) { KeyValuePair <string, IOItem> keyValuePair = (KeyValuePair <string, IOItem>)DataContext; IOItem currentItem = keyValuePair.Value; var infoControl = TemplatedParent.GetParent <NodeInfoContainer>(null); var control = infoControl != null ? infoControl.OriginElement : null; if (control != null) { // We'll need to query the canvas for links //NodeGraphLayout canvas = control.RootCanvas as NodeGraphLayout; TraceLab.UI.WPF.Views.DockableGraph topGraph = control.GetParent <TraceLab.UI.WPF.Views.DockableGraph>(null); NodeGraphLayout canvas = topGraph.graphLayout; // Add the current mapping entries.Add(currentItem.MappedTo); // Get the current item's type so that we can limit the selection to only this type string currentType = currentItem.IOItemDefinition.Type; var availableInputMappingsPerNode = new TraceLab.Core.Utilities.InputMappings(canvas.Graph); ExperimentNode currentNode = control.Vertex as ExperimentNode; //if currentNode is a ExperimentNode, and is ioValidator has incoming outputs for this node (otherwise, it has not been connected to start node) if (currentNode != null && availableInputMappingsPerNode.ContainsMappingsForNode(currentNode)) { foreach (string incomingOutput in availableInputMappingsPerNode[currentNode].Keys) { if (string.Equals(currentType, availableInputMappingsPerNode[currentNode][incomingOutput])) { entries.Add(incomingOutput); } } } } } this.ItemsSource = entries.Distinct(); }
/// <summary> /// Fills the items with incoming outputs from previous nodes. /// </summary> /// <param name="comboBox">The combo box.</param> private void FillItemsWithIncomingOutputsFromPreviousNodes(ComboBox comboBox) { comboBox.Items.Clear(); ExperimentNodeInfo decisionNodeInfo = DataContext as ExperimentNodeInfo; ExperimentNode currentNode = decisionNodeInfo.Node; Dictionary <string, string> predeccessorsOutputsNameTypeLookup; var availableInputMappingsPerNode = new TraceLab.Core.Utilities.InputMappings(m_experiment); if (availableInputMappingsPerNode.TryGetValue(currentNode, out predeccessorsOutputsNameTypeLookup) == false) { predeccessorsOutputsNameTypeLookup = new Dictionary <string, string>(); //return empty - there is not path from start node to decision } foreach (string workspaceUnitName in predeccessorsOutputsNameTypeLookup.Keys) { comboBox.Items.Add(workspaceUnitName); } }
private void fillMetricVariable() { clearComboBox(metricCombobox); ExperimentNode currentNode = m_applicationViewModel.Experiment.StartNode as ExperimentNode; //ExperimentNode currentNode = DecisionControl.ExperimentNode; Dictionary <string, string> predeccessorsOutputsNameTypeLookup; var availableInputMappingsPerNode = new TraceLab.Core.Utilities.InputMappings(m_applicationViewModel.Experiment); if (availableInputMappingsPerNode.TryGetValue(currentNode, out predeccessorsOutputsNameTypeLookup) == false) { predeccessorsOutputsNameTypeLookup = new Dictionary <string, string> (); } foreach (string workspaceUnitName in predeccessorsOutputsNameTypeLookup.Keys) { this.metricCombobox.AppendText(workspaceUnitName); } // setActiveComboBoxValue (metricCombobox, SELECT_A_VALUE); }
private void fillMetricVariable (){ clearComboBox (metricCombobox); ExperimentNode currentNode = m_applicationViewModel.Experiment.StartNode as ExperimentNode; //ExperimentNode currentNode = DecisionControl.ExperimentNode; Dictionary<string, string> predeccessorsOutputsNameTypeLookup; var availableInputMappingsPerNode = new TraceLab.Core.Utilities.InputMappings (m_applicationViewModel.Experiment); if (availableInputMappingsPerNode.TryGetValue (currentNode, out predeccessorsOutputsNameTypeLookup) == false) { predeccessorsOutputsNameTypeLookup = new Dictionary<string, string> (); } foreach (string workspaceUnitName in predeccessorsOutputsNameTypeLookup.Keys) { this.metricCombobox.AppendText ( workspaceUnitName ); } // setActiveComboBoxValue (metricCombobox, SELECT_A_VALUE); }
private void fillLoadComboBox () { clearComboBox (loadComboBox1); ExperimentNode currentNode = DecisionControl.ExperimentNode; Dictionary<string, string> predeccessorsOutputsNameTypeLookup; // TLAB-174: we use the Owner instead of the application experiment to get only variables the scope can access //var availableInputMappingsPerNode = new TraceLab.Core.Utilities.InputMappings (m_applicationContext.Application.Experiment); var availableInputMappingsPerNode = new TraceLab.Core.Utilities.InputMappings (m_decisionControl.ExperimentNode.Owner); if (availableInputMappingsPerNode.TryGetValue (currentNode, out predeccessorsOutputsNameTypeLookup) == false) { predeccessorsOutputsNameTypeLookup = new Dictionary<string, string> (); //return empty - there is not path from start node to decision } String wrapper = "Load(\""; this.loadComboBox1.AppendText (LOAD_A_VALUE); foreach (string workspaceUnitName in predeccessorsOutputsNameTypeLookup.Keys) { this.loadComboBox1.AppendText (wrapper + workspaceUnitName + "\")"); } setActiveComboBoxValue (loadComboBox1, LOAD_A_VALUE); }
/// <summary> /// Fills the items with incoming outputs from previous nodes. /// </summary> /// <param name="comboBox">The combo box.</param> private void FillItemsWithIncomingOutputsFromPreviousNodes(ComboBox comboBox) { comboBox.Items.Clear(); ExperimentNodeInfo decisionNodeInfo = DataContext as ExperimentNodeInfo; ExperimentNode currentNode = decisionNodeInfo.Node; Dictionary<string, string> predeccessorsOutputsNameTypeLookup; var availableInputMappingsPerNode = new TraceLab.Core.Utilities.InputMappings(m_experiment); if (availableInputMappingsPerNode.TryGetValue(currentNode, out predeccessorsOutputsNameTypeLookup) == false) { predeccessorsOutputsNameTypeLookup = new Dictionary<string, string>(); //return empty - there is not path from start node to decision } foreach (string workspaceUnitName in predeccessorsOutputsNameTypeLookup.Keys) { comboBox.Items.Add(workspaceUnitName); } }