private void ExecuteSqlEventsAfterExecute(string guid, int id, object customin, object customout) { try { if (enableApp) { var textDocument = (TextDocument)document.Object("TextDocument"); //selected text to execute string queryText = textDocument.Selection.Text; if (string.IsNullOrEmpty(OriginalQueryText)) { //No original query text } else { //Replace with original query StartPoint.ReplaceText(EndPoint, OriginalQueryText, 8); } } } catch (Exception) { throw; } }
public void JoinedStreams() { StartPoint <int> s1 = new StartPoint <int>( (IWritableQueue <int> o) => { o.Send(1); o.Send(3); o.Send(5); o.Send(7); } ); StartPoint <int> s2 = new StartPoint <int>( (IWritableQueue <int> o) => { o.Send(11); o.Send(13); o.Send(15); o.Send(17); } ); Collector <int> end = new Collector <int>(); Flow f = Flow.FromAsciiArt(@" a--+ V b--#-->c ", new Dictionary <char, TaskNode>() { { 'a', s1 }, { 'b', s2 }, { 'c', end } }); f.Start(); f.RunToCompletion(); Assert.AreEqual(8, end.Items.Count); }
public void UpdateInfoToUI() { if (Size.Equals(0)) { NoteTexture.gameObject.transform.localScale = new Vector3(0.8f, 0.8f, 1); WhiteTexture.gameObject.transform.localScale = new Vector3(0.8f, 0.8f, 1); } else if (Size.Equals(1)) { NoteTexture.gameObject.transform.localScale = new Vector3(1, 1, 1); WhiteTexture.gameObject.transform.localScale = new Vector3(1, 1, 1); } else if (Size.Equals(2)) { Body.localScale = new Vector3(1.3f, 1.3f, 1); Type = 0; Flick = 0; NoteTexture.sprite = ParentBlock.Table.SpecialNote; WhiteTexture.sprite = ParentBlock.Table.SpecialWhiteNote; } SpeedText.text = Speed.ToString("N1"); if (StartPoint.Equals(0)) { StartPoint = EndPoint; } StartLineText.text = StartPoint.ToString("N1"); }
/// <summary> /// Transforms the line using the transformation matrix. /// </summary> /// <param name="transform">Transformation matrix to apply.</param> /// <returns>A line transformed.</returns> public Line Transform(Transform transform) { Point3 pt1 = StartPoint.Transform(transform); Point3 pt2 = EndPoint.Transform(transform); return(new Line(pt1, pt2)); }
public void ExceptionsFromTasks() { StartPoint <int> start = StandardTasks.GetRangeEnumerator(1, 10); int i = 0; EndPoint <int> end = new EndPoint <int>( (int input) => { i++; throw new InvalidTimeZoneException(); } ); end.Retries = 3; Flow f = Flow.FromAsciiArt("b<--a", start, end); f.Start(); try { f.RunToCompletion(); Assert.Fail("RunToCompletion should throw any stopping exceptions from tasks"); } catch (InvalidTimeZoneException) { } Console.WriteLine("Exceptions thown : {0}", i); Console.WriteLine("Status of flow after error: \n{0}", f.GetStateSnapshot()); Assert.AreEqual(RunStatus.Error, end.Status); Assert.AreEqual(0, end.ItemsProcessed); }
private void Start() { if (!isDestination) { CorrespondingStartPoint = GetComponent <StartPoint>(); } }
public void KeepOrder2() { List <int> results = new List <int>(); Random r = new Random(); StartPoint <int> s = Helpers.GetStartpointCounter(1, 50); TaskNode <int, int> process = new TaskNode <int, int>( (int input, IWritableQueue <int> output) => { int sleeptime = r.Next(50); Thread.Sleep(sleeptime); output.Send(input); } ) { ThreadNumber = 5, KeepOrder = true }; Collector <int> n = new Collector <int>(); Flow f = Flow.FromAsciiArt("c<----b<---0a", new Dictionary <char, TaskNode>() { { 'a', s }, { 'b', process }, { 'c', n } }); f.Start(); f.RunToCompletion(); int vorig = 0; foreach (var item in n.Items) { Assert.AreEqual(vorig + 1, item); vorig = item; } }
public TimeBucket <TCalendar> AddDatePart(int value) { Given = StartPoint = DatePart switch { DatePart.Minute => StartPoint.AddMinutes(value), DatePart.Hour => StartPoint.AddHours(value), DatePart.Day => StartPoint.AddDays(value), DatePart.Week => StartPoint.AddDays(7 * value), DatePart.Month => _calendar.AddMonths(StartPoint, value), DatePart.Year => _calendar.AddYears(StartPoint, 1), _ => throw new ArgumentOutOfRangeException(nameof(Contract.DatePart), DatePart, null) }; EndPoint = DatePart switch { DatePart.Minute => EndPoint.AddMinutes(value), DatePart.Hour => EndPoint.AddHours(value), DatePart.Day => EndPoint.AddDays(value), DatePart.Week => EndPoint.AddDays(7 * value), DatePart.Month => _calendar.AddMonths(EndPoint, value), DatePart.Year => _calendar.AddYears(EndPoint, 1), _ => throw new ArgumentOutOfRangeException(nameof(Contract.DatePart), DatePart, null) }; PartialStart = PartialEnd = false; return(this); }
void Update() { if (currentLevel <= levelref.Count - 1) { float step = risingSpeed * Time.deltaTime; levelref[currentLevel].transform.position = Vector3.MoveTowards(levelref[currentLevel].transform.position, targetPos, step); } if (levelref[currentLevel].transform.FindChild("Goal").position.y < GameObject.FindGameObjectWithTag("OceanRef").GetComponentInParent <Bassin>().getWaterLevelAtMyLocation(levelref[currentLevel].transform.FindChild("Goal").gameObject) && levelRunning) { if (!GameManager.Instance.GetComponent <AudioManager>().GetgameOverSoundPlay()) { GameManager.Instance.GetComponent <AudioManager>().GameOverSound(); StartCoroutine(StartPoint.getStartPoint().GetComponent <StartPoint>().RestartDelay()); GameManager.Instance.GetComponent <AudioManager>().SetgameOverSoundPlay(true); gameOver = true; } } if (currentLevel == 0) { if (playersScore[0] + playersScore[1] == 2) { levelref[currentLevel].GetComponentInChildren <Faucet>().debit = 10; } } }
public Point?Intersection(LineSegment that) { if (StartPoint.Equals(that.EndPoint)) { return(StartPoint); } if (EndPoint.Equals(that.StartPoint)) { return(EndPoint); } if (StartPoint.Equals(that.StartPoint)) { return(Line.Slope.Equals(that.Line.Slope) ? (Point?)null : StartPoint); } if (EndPoint.Equals(that.EndPoint)) { return(Line.Slope.Equals(that.Line.Slope) ? (Point?)null : EndPoint); } var p = Line.Intersection(that.Line); if (p == null || !Contains((Point)p) || !that.Contains((Point)p)) { return(null); } return(p); }
/// <summary> /// True if either endpoint is found in direct contact with any segment that makes up /// the polygon borders. /// </summary> /// <param name="Pgn">The polygon to compare against</param> /// <returns>Boolean, true if either endpoint of this segment touches any segment of the polygon.</returns> public bool TouchesTheBoundaryOf(Polygon Pgn) { List <Segment> Segs = null; if (Pgn.Extents.IntersectWith(StartPoint) == true) { Segs = Pgn.SegmentsWithin(this.Extents); for (int I = 0; I < Segs.Count; I++) { if (StartPoint.IntersectsWith(Segs[I])) { return(true); } } } else { if (Pgn.Extents.IntersectWith(EndPoint) == false) { return(false); } } if (Segs == null) { Segs = Pgn.SegmentsWithin(this.Extents); } for (int I = 0; I < Segs.Count; I++) { if (EndPoint.IntersectsWith(Segs[I])) { return(true); } } return(false); }
public void JoinedStreams() { StartPoint<int> s1 = new StartPoint<int>( (IWritableQueue<int> o)=> { o.Send(1); o.Send(3); o.Send(5); o.Send(7); } ); StartPoint<int> s2 = new StartPoint<int>( (IWritableQueue<int> o) => { o.Send(11); o.Send(13); o.Send(15); o.Send(17); } ); Collector<int> end = new Collector<int>(); Flow f = Flow.FromAsciiArt(@" a--+ V b--#-->c ", new Dictionary<char, TaskNode>() { {'a', s1}, {'b', s2}, {'c', end} }); f.Start(); f.RunToCompletion(); Assert.AreEqual(8, end.Items.Count); }
public App() { startPoint = new StartPoint(this); startPoint.Start(); InitializeComponent(); }
public string ToStringOfVerR13() { string str = ToString(); str = str.Insert(str.IndexOf(StartPoint.ToStringOf2d()), "100\nAcDbLine\n"); return(str); }
public MarkGeometrySpline(Spline spline) : base() { FitPoints = spline.FitPoints.ConvertAll(x => new MarkGeometryPoint(x)); ControlPoints = new List <SplineVertex>(spline.ControlPoints).ConvertAll(x => new MarkGeometryPoint(x.Position));; Knots = spline.Knots.ToList(); IsPeriodic = spline.IsPeriodic; IsClosed = spline.IsClosed; Degree = spline.Degree; // TODO : Remove var polyline = spline.ToPolyline(spline.ControlPoints.Count * 5); Points.AddRange( polyline.Vertexes.Select(v => new MarkGeometryPoint(v.Position)) ); if ( polyline.IsClosed && GeometricArithmeticModule.Compare(StartPoint, EndPoint, ClosureTolerance) != 0) { Points.Add((MarkGeometryPoint)StartPoint.Clone()); } // END Remove Update(); }
public void Offset(float dx, float dy) { StartPoint.Offset(dx, dy); Control1.Offset(dx, dy); Control2.Offset(dx, dy); Vertex.Offset(dx, dy); }
public Point ComputePointByT(double t) { return (StartPoint.Mul(-1) .Plus( FirstCtrlPoint.Mul(3) ) .Minus( SecondCtrlPoint.Mul(3) ) .Plus(EndPoint) .Mul(t * t * t) .Plus( StartPoint.Minus( FirstCtrlPoint.Mul(2) ) .Plus(SecondCtrlPoint) .Mul(3 * t * t) ) .Plus( StartPoint .Mul(-1) .Plus(FirstCtrlPoint) .Mul(3 * t) ) .Plus(StartPoint) ); }
//입출구 탐색 //입구 찾기 (우선순위 좌>상>하) //출구 찾기 (우선순위 우>하>상) public void FindInOut() { //이미 입구와 출구가 있으면 if (!(StartPoint.IsNull() && EndPoint.IsNull())) { return; //작업 취소 } for (int y = 0; y < Height; y++) { //좌 입구 if (CharMap[y][0] == '0') { Point start = new Point(0, y); StartPoint = start; } //우 출구 if (CharMap[y][Width - 1] == '0') { Point end = new Point(Width - 1, y); EndPoint = end; } } for (int x = 0; x < Width; x++) { //상 if (CharMap[0][x] == '0') { //입구 if (StartPoint.IsNull()) { Point start = new Point(x, 0); StartPoint = start; } //출구 else if (EndPoint.IsNull()) { Point end = new Point(x, 0); EndPoint = end; } } //하 if (CharMap[Height - 1][x] == '0') { //출구 if (EndPoint.IsNull()) { Point end = new Point(x, Height - 1); EndPoint = end; } //입구 else if (StartPoint.IsNull()) { Point start = new Point(x, Height - 1); StartPoint = start; } } } }
internal override bool TrySetPair(DxfCodePair pair) { switch (pair.Code) { case 10: StartPoint = StartPoint.WithUpdatedX(pair.DoubleValue); break; case 20: StartPoint = StartPoint.WithUpdatedY(pair.DoubleValue); break; case 11: EndPoint = EndPoint.WithUpdatedX(pair.DoubleValue); break; case 21: EndPoint = EndPoint.WithUpdatedY(pair.DoubleValue); break; default: return(false); } return(true); }
protected override void UpdateUIRepresentationCore() { base.UpdateUIRepresentationCore(); var transform = Plotter.Viewport.Transform; Point p1 = StartPoint.DataToScreen(transform); Point p2 = EndPoint.DataToScreen(transform); Vector arrowVector = p1 - p2; Vector arrowCapVector = ArrowLength * arrowVector; Matrix leftMatrix = Matrix.Identity; leftMatrix.Rotate(ArrowAngle); Matrix rightMatrix = Matrix.Identity; rightMatrix.Rotate(-ArrowAngle); Vector leftArrowLine = leftMatrix.Transform(arrowCapVector); Vector rightArrowLine = rightMatrix.Transform(arrowCapVector); leftLineGeometry.StartPoint = p2; rightLineGeometry.StartPoint = p2; leftLineGeometry.EndPoint = p2 + leftArrowLine; rightLineGeometry.EndPoint = p2 + rightArrowLine; }
public bool Equals(CommonLinearGradientBrush other) { return(other != null && base.Equals(other) && StartPoint.Equals(other.StartPoint) && EndPoint.Equals(other.EndPoint)); }
protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options) { base.setJSON(obj, host, options); obj["StartPoint"] = StartPoint.getJson(this, options); obj["StartDirection"] = StartDirection; obj["SegmentLength"] = SegmentLength; }
public void ThreeStepWithFilter() { List <string> results = new List <string>(); StartPoint <int> s = Helpers.GetStartpointCounter(1, 100); // pass only numbers divisible by three with no 2 in them // Output in TaskNode <int, string> filter = Helpers.GetFilter(); filter.ItemProcessed += new EventHandler <TaskNode.ItemEventArgs>(EndItemProcessed); EndPoint <string> n = Helpers.GetEndpoint(results); Flow flow = Helpers.ConnectStartFilterEnd(s, filter, n); flow.Start(); flow.RunToCompletion(); Assert.Contains(flow.Status, new List <RunStatus>() { RunStatus.Stopped, RunStatus.Stopping }); Assert.AreEqual(27, results.Count); Assert.AreEqual(results.Count, n.ItemsProcessed); Assert.AreEqual(1, s.ItemsProcessed); Console.WriteLine(flow.GetStateSnapshot()); Assert.Greater(s.TotalSecondsProcessing, 0); Assert.Greater(filter.TotalSecondsProcessing, 0); Assert.Greater(filter.TotalSecondsBlocked, 0); // Each node works with one thread, so order is maintained, so: Assert.AreEqual('3', results[0][0]); }
public void ChangeStartPos(int moveVal) { if (moveVal.Equals(0)) { StartPoint -= 1; } else if (moveVal.Equals(1)) { StartPoint += 1; } if (StartPoint < 0) { StartPoint = MaxLine; } if (StartPoint > MaxLine) { StartPoint = 0; } StartPointText.text = StartPoint.ToString("N0"); if (StartPoint.Equals(0)) { StartPointText.text = LocaleManager.instance.GetLocaleText("creator_auto"); } if (SelectedNote.Count > 0) { foreach (CreatorNote note in SelectedNote) { note.StartPoint = StartPoint; note.UpdateInfoToUI(); } } }
public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) { return(false); } if (ReferenceEquals(this, obj)) { return(true); } if (obj.GetType() != GetType()) { return(false); } var cmpr = obj as Line3D; if (cmpr == null) { return(false); } bool startEqual = (StartPoint != null && cmpr.StartPoint != null && StartPoint.Equals(cmpr.StartPoint)) || (StartPoint == null && cmpr.StartPoint == null); bool endEqual = (EndPoint != null && cmpr.EndPoint != null && EndPoint.Equals(cmpr.EndPoint)) || (EndPoint == null && cmpr.EndPoint == null); return(startEqual && endEqual); }
/// <summary> /// Update current position within the path of the way /// </summary> public void UpdateWayPosition() { if (null == StartPoint) // we are not in any segment of path { Direction = Vector3.zero; Distance = 0; return; } if (null == EndPoint) { EndPoint = StartPoint.NextWayPoint(); if (null == EndPoint) // we might arrive the final point { Direction = Vector3.zero; Distance = 0; return; } } Vector3 vecToEnd = (EndPoint.transform.position - transform.position); if (vecToEnd.magnitude < ThresholdDistanceToEnd) { StartPoint = EndPoint; EndPoint = StartPoint.NextWayPoint(); } Direction = vecToEnd.normalized; Distance = vecToEnd.magnitude; }
public void Offset(OffsetTypes offsetType, params float[] offsets) { var result = new IDot[2]; switch (offsetType) { case OffsetTypes.Usual: { result = Transformer3D.Offset(offsets, new IDot[] { StartPoint, EndPoint }); break; } case OffsetTypes.MatrixOffset: { result = Transformer3D.Action(offsets, new IDot[] { StartPoint, EndPoint }); break; } case OffsetTypes.HouseOffset: { result = Transformer3D.HomeMoving(offsets[0], offsets[1], offsets[2], new IDot[] { StartPoint, EndPoint }); break; } } StartPoint = result[0]; EndPoint = result[1]; StartPoint.Normalise(); EndPoint.Normalise(); }
public double Find(StartPoint anotherPoint) { return(Math.Sqrt( Math.Pow(anotherPoint.X - this.X, 2) + Math.Pow(anotherPoint.Y - this.Y, 2) )); }
public override void Transform(Matrix4x4 transformationMatrixIn) { StartPoint.Transform(transformationMatrixIn); EndPoint.Transform(transformationMatrixIn); Update(); }
public void StartingAndStopping() { StartPoint <int> s = Helpers.GetStartpointCounter(1, 15); // pass only numbers divisible by three with no 2 in them // Output in TaskNode <int, string> filter = Helpers.GetFilter(); filter.ThreadNumber = 2; Collector <string> collect = new Collector <string>(); filter.ItemProcessed += new EventHandler <TaskNode.ItemEventArgs>(StopFlowItemProcessed); Flow flow = Flow.FromAsciiArt("c->d--->e", s, filter, collect); flow.Start(); // Flow will be stopped from evnt handler // Give it time to do it wrong: Thread.Sleep(100); Assert.Greater(collect.Items.Count, 0); Assert.Less(collect.Items.Count, 4); flow.RunToCompletion(); try { Console.WriteLine(flow.Status); //flow.Start(); //Assert.Fail("An exception should be thrown when starting a stopped flow"); } catch (InvalidOperationException) { //noop } }
public async Task <IActionResult> Edit(int id, [Bind("Id,StartPointName,StartPointDescription,StartPointLongitude,StartPointLatitude,UserId")] StartPoint startPoint) { if (id != startPoint.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(startPoint); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StartPointExists(startPoint.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(startPoint)); }
private void Init() { _startpointDataSet = _commandHandlerContainer.Resolve<StartpointDataSet>(); _startpointDataSource = _commandHandlerContainer.Resolve<StartpointDataSource>(); _startpointReports = _commandHandlerContainer.Resolve<StartpointReports>(); _startpointReportsEng = _commandHandlerContainer.Resolve<StartpointReportsEng>(); _startpointReportsEngUtv = _commandHandlerContainer.Resolve<StartpointReportsEngUtv>(); _startpointReportsNorUtv = _commandHandlerContainer.Resolve<StartpointReportsUtv>(); }
public void ConnectingPolymorphicTypes() { StartPoint<B> s = new StartPoint<B>((IWritableQueue<B> q) => q.Send(new B())); EndPoint<A> e = new EndPoint<A>((A q) => { }); Flow flow = new Flow(); flow.AddNode(s); flow.AddNode(e); flow.ConnectNodes(s, e, 0); }
private void Resolve() { _startpointIntegrationPacks = _commandHandlerContainer.Resolve<StartpointIntegrationPacks>(); _startpointSsisBatch = _commandHandlerContainer.Resolve<StartpointSSISBatch>(); _startpointDataSet = _commandHandlerContainer.Resolve<StartpointDataSet>(); _startpointDataSource = _commandHandlerContainer.Resolve<StartpointDataSource>(); _startpointReportsEng = _commandHandlerContainer.Resolve<StartpointReportsEng>(); _startpointSql = _commandHandlerContainer.Resolve<StartpointSql>(); _startpointDeployment = _commandHandlerContainer.Resolve<StartpointDeployment>(); _startpointCompression = _commandHandlerContainer.Resolve<StartpointCompression>(); }
internal static StartPoint<int> GetStartpointCounter(int from, int to) { StartPoint<int> s = new StartPoint<int>( (IWritableQueue<int> o) => { for (int i = from; i <= to; i++) { o.Send(i); } } ); return s; }
static void Main() { //input int[,] matrix = { {1,1,1,1,3}, {1,1,1,1,1}, {1,1,1,1,1}, {9,1,1,1,4}, }; //solution int leftmostStart = matrix.GetLength(1) - 2; int downmostStart = matrix.GetLength(0) - 2; int maxSum = int.MinValue; StartPoint bestStart = new StartPoint(); for (int row = 0; row < downmostStart; row++) { for (int col = 0; col < leftmostStart; col++) { int sum = 0; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { sum += matrix[row + i, col + j]; } } if (sum >= maxSum) { maxSum = sum; bestStart.row = row; bestStart.col = col; } } } //output for (int row = 0; row < 3; row++) { for (int col = 0; col < 3; col++) { Console.Write("{0, 3} ", matrix[bestStart.row + row, bestStart.col + col]); } Console.WriteLine(); } }
public void ConsoleLogging() { StartPoint<int> s = new StartPoint<int>((IWritableQueue<int> outQ) => { for (int i = 0; i < 100; i++) { Console.WriteLine("Sending {0}", i); outQ.Send(i); } }); EndPoint<int> n = new EndPoint<int>((int i)=>Console.WriteLine("Received {0}", i)); n.ThreadNumber = 4; Flow flow = Flow.FromAsciiArt("s-->e", new Dictionary<char, TaskNode>() { {'s', s}, {'e', n} }); flow.Start(); flow.RunToCompletion(); }
private void Resolve() { _startpointIntegrationPacks = _commandHandlerContainer.Resolve<StartpointIntegrationPacks>(); _startpointSsisBatch = _commandHandlerContainer.Resolve<StartpointSSISBatch>(); _startpointCompression = _commandHandlerContainer.Resolve<StartpointCompression>(); }
static void Draw ( StartPoint _c, GizmoType _gizmoType ) { if ( EditorApplication.isPlaying ) return; Vector3 position = _c.transform.position; Gizmos.DrawIcon (position, "Foobar.ico"); }