Ejemplo n.º 1
0
            private void MovePoint(
                RegressionEnvironment env,
                SupportSpatialEventRectangle rectangle,
                Random random,
                EPFireAndForgetPreparedQueryParameterized preparedDelete)
            {
                double newX;
                double newY;

                while (true) {
                    newX = rectangle.X.Value;
                    newY = rectangle.Y.Value;
                    var direction = random.Next(4);
                    if (direction == 0 && newX > 0) {
                        newX--;
                    }

                    if (direction == 1 && newY > 0) {
                        newY--;
                    }

                    if (direction == 2 && newX < WIDTH - 1) {
                        newX++;
                    }

                    if (direction == 3 && newY < HEIGHT - 1) {
                        newY++;
                    }

                    if (BoundingBox.IntersectsBoxIncludingEnd(
                        0,
                        0,
                        WIDTH,
                        HEIGHT,
                        newX,
                        newY,
                        rectangle.Width.Value,
                        rectangle.Height.Value)) {
                        break;
                    }
                }

                // Comment-me-in:
                // log.info("Moving " + rectangle.getId() + " from " + printPoint(rectangle.getX(), rectangle.getY()) + " to " + printPoint(newX, newY));
                preparedDelete.SetObject("Id", rectangle.Id);
                env.Runtime.FireAndForgetService.ExecuteQuery(preparedDelete);

                rectangle.X = newX;
                rectangle.Y = newY;
                SendEventRectangle(
                    env,
                    rectangle.Id,
                    rectangle.X.Value,
                    rectangle.Y.Value,
                    rectangle.Width.Value,
                    rectangle.Height.Value);
            }
Ejemplo n.º 2
0
 public static void SendAddRectangle(
     RegressionEnvironment env,
     IList<SupportSpatialEventRectangle> rectangles,
     string id,
     double x,
     double y,
     double width,
     double height)
 {
     var rectangle = new SupportSpatialEventRectangle(id, x, y, width, height);
     rectangles.Add(rectangle);
     env.SendEventBean(rectangle);
 }