Android Open Source - slider Point






From Project

Back to project page slider.

License

The source code is released under:

Apache License

If you think the Android project slider listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package de.devisnik.sliding;
/*from   w  w  w  .ja  v  a 2  s .co  m*/
public class Point {

  public static Point diff(Point left, Point right) {
    return new Point(left.x - right.x, left.y - right.y);
  }

  public static Point divide(int width, int height, Point size) {
    return new Point(width / size.x, height / size.y);
  }

  public static Point divide(Point left, Point right) {
    return new Point(left.x / right.x, left.y / right.y);
  }

  public static Point divide(Point left, int number) {
    return new Point(left.x / number, left.y / number);
  }

  public static Point sum(Point point, int x, int y) {
    return new Point(point.x + x, point.y + y);
  }

  public static Point times(Point point, float factor) {
    return new Point(Math.round(factor * point.x), Math.round(factor * point.y));
  }

  public static Point times(Point point, int factor) {
    return new Point(factor * point.x, factor * point.y);
  }

  public static Point times(Point left, Point right) {
    return new Point(left.x * right.x, left.y * right.y);
  }

  public int x;
  public int y;

  public Point() {
    this(0, 0);
  }

  public Point(int x, int y) {
    this.x = x;
    this.y = y;
  }

  public Point add(Point point) {
    x += point.x;
    y += point.y;
    return this;
  }

  public Point set(Point point) {
    this.x = point.x;
    this.y = point.y;
    return this;
  }

  public int min() {
    return Math.min(x, y);
  }

  public int max() {
    return Math.max(x, y);
  }

  public float ratio() {
    return ((float) x) / y;
  }

  public Point flip() {
    int mem = x;
    x = y;
    y = mem;
    return this;
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj)
      return true;
    if (obj == null)
      return false;
    if (getClass() != obj.getClass())
      return false;
    Point other = (Point) obj;
    if (x != other.x)
      return false;
    if (y != other.y)
      return false;
    return true;
  }

  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + x;
    result = prime * result + y;
    return result;
  }

  @Override
  public String toString() {
    return "(" + x + "," + y + ")";
  }

  public Point divideBy(Point point) {
    x /= point.x;
    y /= point.y;
    return this;
  }

  public Point multiplyBy(Point point) {
    x *= point.x;
    y *= point.y;
    return this;
  }

  public Point minus(Point point) {
    x -= point.x;
    y -= point.y;
    return this;
  }

  public Point divideBy(int number) {
    x /= number;
    y /= number;
    return this;
  }

  public Point copy() {
    return new Point(x, y);
  }
}




Java Source Code List

de.devisnik.android.sliding.ARandom.java
de.devisnik.android.sliding.FPSCounter.java
de.devisnik.android.sliding.FrameDrawer.java
de.devisnik.android.sliding.ISpeed.java
de.devisnik.android.sliding.ImageCache.java
de.devisnik.android.sliding.ImageFactory.java
de.devisnik.android.sliding.Logger.java
de.devisnik.android.sliding.OpenActivity.java
de.devisnik.android.sliding.OpenPreviewActivity.java
de.devisnik.android.sliding.PropertiesBuilder.java
de.devisnik.android.sliding.RenderHandler.java
de.devisnik.android.sliding.Replayer.java
de.devisnik.android.sliding.Settings.java
de.devisnik.android.sliding.SlidingPreferences.java
de.devisnik.android.sliding.SlidingWallpaper.java
de.devisnik.android.sliding.SpeedFactory.java
de.devisnik.android.sliding.SummaryUpdater.java
de.devisnik.android.sliding.tile.BitmapCachingPieceDrawer.java
de.devisnik.android.sliding.tile.CachingPieceDrawer.java
de.devisnik.android.sliding.tile.IPieceDrawer.java
de.devisnik.android.sliding.tile.ImagePieceDrawer.java
de.devisnik.android.sliding.tile.NumberPieceDrawer.java
de.devisnik.android.sliding.tile.PieceDrawerFactory.java
de.devisnik.android.sliding.tile.TileShifter.java
de.devisnik.android.sliding.tile.TileStore.java
de.devisnik.android.sliding.tile.Tile.java
de.devisnik.sliding.FrameFactory.java
de.devisnik.sliding.FrameScrambler.java
de.devisnik.sliding.FromHomeShiftingEvent.java
de.devisnik.sliding.IFrameListener.java
de.devisnik.sliding.IFrame.java
de.devisnik.sliding.IHole.java
de.devisnik.sliding.IMove.java
de.devisnik.sliding.IPiece.java
de.devisnik.sliding.IRandom.java
de.devisnik.sliding.IRobotFrame.java
de.devisnik.sliding.IShifterListener.java
de.devisnik.sliding.MoveFactory.java
de.devisnik.sliding.Point.java
de.devisnik.sliding.ShiftingEvent.java
de.devisnik.sliding.ToHomeShiftingEvent.java
de.devisnik.sliding.animation.AccelerateDecelerateInterpolator.java
de.devisnik.sliding.animation.AnimationRunner.java
de.devisnik.sliding.animation.Animation.java
de.devisnik.sliding.animation.IInterpolator.java
de.devisnik.sliding.animation.IMovement.java
de.devisnik.sliding.animation.IShiftable.java
de.devisnik.sliding.animation.LinearInterpolator.java
de.devisnik.sliding.animation.MetaShiftable.java
de.devisnik.sliding.animation.ShiftAnimation.java
de.devisnik.sliding.animation.Translation.java
de.devisnik.sliding.impl.Frame.java
de.devisnik.sliding.impl.Hole.java
de.devisnik.sliding.impl.Move.java
de.devisnik.sliding.impl.PieceIterator.java
de.devisnik.sliding.impl.Piece.java
de.devisnik.sliding.impl.RobotFrame.java
de.devisnik.sliding.impl.Scrambler.java