Пример #1
0
 /**
  * Collision of two balls has the effect that both balls 'turn around' 180 degrees. Could be
  * better
  */
 public void collide(Ball other, JFrame jframe) {
   if (this.position().distance(other.position()) < BALL_DIAM) {
     Bounce jframe2 = (Bounce) jframe;
     jframe2.getBallPanel().addNewBall(jframe);
     int dxTemp = this.dx;
     int dyTemp = this.dy;
     this.dx = other.dx;
     this.dy = other.dy;
     other.dx = dxTemp;
     other.dy = dyTemp;
   }
 }
Пример #2
0
  @POST
  @Path("/{token}")
  @Consumes(MediaType.APPLICATION_JSON)
  public Response bounced(@PathParam("token") String token, Bounce bounce) {

    if (Strings.isNullOrEmpty(bounceHookToken) || !bounceHookToken.equals(token)) {
      throw new WebApplicationException(Status.UNAUTHORIZED);
    }

    LOGGER.info("Subject = " + bounce.getSubject());
    LOGGER.info("Email = " + bounce.getEmail());
    LOGGER.info("Type = " + bounce.getType());
    LOGGER.info("Token = " + token);

    return Response.ok().build();
  }