View Javadoc

    1   package baseCode.dataStructure;
    2
    3   /***
    4    * <p>
    5    * Title:
    6    * </p>
    7    * <p>
    8    * Description:
    9    * </p>
    10   * <p>
    11   * Copyright (c) 2004
    12   * </p>
    13   * <p>
    14   * Institution:: Columbia University
    15   * </p>
    16   *
    17   * @author Paul Pavlidis
    18   * @version $Id: Point.java,v 1.4 2004/07/27 03:18:58 pavlidis Exp $
    19   */
    20
    21  public class Point {
    22
    23     private int x, y;
    24
    25     /***
    26      * @param i
    27      * @param j
    28      */
    29     public Point( int i, int j ) {
    30        set( i, j );
    31     }
    32
    33     /***
    34      * @param i
    35      * @param j
    36      */
    37     public void set( int i, int j ) {
    38        x = i;
    39        y = j;
    40     }
    41
    42     /***
    43      * @return array containing the coordinates x,y.
    44      */
    45     public int[] get() {
    46        return new int[] {
    47              x, y
    48        };
    49     }
    50
    51     /***
    52      * @return x the x value.
    53      */
    54     public int getx() {
    55        return x;
    56     }
    57
    58     /***
    59      * @return y the y value.
    60      */
    61     public int gety() {
    62        return y;
    63     }
    64
    65     /***
    66      * @return string representation of the point.
    67      */
    68     public String toString() {
    69        return new String( x + "\t" + y );
    70     }
    71
    72  }