public static LineOperation GetLineOperation() { IUnityContainer container = new UnityContainer(); container.RegisterType <ILineOperation, LineOperation>(); LineOperation lineOperation = container.Resolve <LineOperation>(); return(lineOperation); }
public static LineOperation GetLineOperation() { UnityContainer unityContainer = new UnityContainer(); unityContainer.RegisterType <ILineOperation, LineOperation>(); LineOperation lineOperation = unityContainer.Resolve <LineOperation>(); return(lineOperation); //throw new NotImplementedException(); }
public static void Main(string[] args) { // 3x + 4y = 1 Line line1 = new Line(3, 4, 1); // 2x + 5y = 3 Line line2 = new Line(2, 5, 3); LineOperation lineOperation = new LineOperation(); Vector intersectionPoint = lineOperation.getIntersection(line1, line2); Console.WriteLine("Test using line equation"); printVector(intersectionPoint); Console.WriteLine("Test using points"); intersectionPoint = lineOperation.getIntersection(new Vector(2, 5), new Vector(5, 3), new Vector(7, 4), new Vector(1, 6)); printVector(intersectionPoint); }
/// <summary> /// The main REPL loop /// </summary> /// <param name="linevm">Current line being evaluated</param> /// <param name="stayOnCurrentLine">whether or not to progress to the next line of the REPL</param> private async Task ReadEvalPrintLoop(WindowViewModel windowvm, LineViewModel linevm, LineOperation mode) { // read string text = string.Empty; if (mode.HasFlag(LineOperation.Evaluate)) { ClearPreviousOutput(linevm); text = linevm.Document.Text; } // eval var result = await services.AppendEvaluationAsync(linevm.Id, text, new Logger(linevm)); if (mode.HasFlag(LineOperation.Evaluate)) { if (result == LineEvaluationResult.IncompleteInput) { linevm.Document.Text += Environment.NewLine; return; } if (!string.IsNullOrEmpty(result.FormattedInput)) { linevm.Document.Text = result.FormattedInput; } // print if (result != LineEvaluationResult.NoOutput) { Print(linevm, result); } } // loop if (!mode.HasFlag(LineOperation.Reevaluate) && result.Exception == null) { var newLineId = MoveToNextLine(windowvm, linevm); if (newLineId.HasValue) { _ = services.AppendEvaluationAsync(newLineId.Value, "", new NullLogger()); // run empty evaluation to create a corresponding compilation in roslyn } } }