public void Execute(string command) { Regex regex = new Regex(@"print_debug ([a-zA-Z][a-zA-Z0-9_-]*)"); Match match = regex.Match(command); if (match.Success) { var o_identifier = match.Groups[1].Value; if (_model.Obstacle(o_identifier) != null) { var monitor = _modelMonitor.GetMonitor(o_identifier); if (monitor != null) { Console.WriteLine("Debug:"); Console.WriteLine(monitor.Storage.PrintDebug()); } else { Console.WriteLine($"Obstacle '{o_identifier}' not found."); } } } }
public void Execute(string command) { Regex regex = new Regex(@"satrate ([a-zA-Z][a-zA-Z0-9_-]*)"); Match match = regex.Match(command); if (match.Success) { var o_identifier = match.Groups[1].Value; if (_root.Contains(o_identifier)) { Console.WriteLine($"{_modelMonitor.RootSatisfactionRates[o_identifier]}"); } if (_model.Obstacle(o_identifier) != null) { var monitor = _modelMonitor.GetMonitor(o_identifier); if (monitor != null) { var state = monitor.MonitoredSatisfactionRate; if (state != null) { Console.WriteLine($"{state.Mean} ({state.Negative}/{(state.Negative + state.Positive)})"); } else { Console.WriteLine("No states observed so far."); } } else { Console.WriteLine($"Obstacle '{o_identifier}' not found."); } } } }
private void Delete(Resolution resolution, bool others = true) { Obstacle obstacle = _model.Obstacle(resolution.ObstacleIdentifier); _model.obstacleRepository.Remove(resolution); if (!others) { return; } foreach (var obstruction in obstacle.Obstructions().ToList()) { _model.obstacleRepository.Remove(obstruction); } foreach (var refinement in _model.ObstacleRefinements(x => x.SubobstacleIdentifiers.Any(y => y.Identifier == obstacle.Identifier))) { foreach (var refinee in refinement.SubobstacleIdentifiers.Where(x => x.Identifier == obstacle.Identifier).ToList()) { refinement.SubobstacleIdentifiers.Remove(refinee); } } }