source: ether_statistics/service/implementation/gov/noaa/pmel/util/Dimension2D.java @ 569

Last change on this file since 569 was 569, checked in by vmipsl, 12 years ago

Nouveau projet

File size: 2.2 KB
Line 
1/*
2 * $Id: Dimension2D.java,v 1.3 2001/02/09 18:42:30 dwd Exp $
3 *
4 * This software is provided by NOAA for full, free and open release.  It is
5 * understood by the recipient/user that NOAA assumes no liability for any
6 * errors contained in the code.  Although this software is released without
7 * conditions or restrictions in its use, it is expected that appropriate
8 * credit be given to its author and to the National Oceanic and Atmospheric
9 * Administration should the software be included by the recipient as an
10 * element in other product development.
11 */
12 
13package gov.noaa.pmel.util;
14
15/**
16 * A class to encapsulate a <code>double</code> width and a height.
17 *
18 * @author Donald Denbo
19 * @version $Revision: 1.3 $, $Date: 2001/02/09 18:42:30 $
20 * @since sgt 1.0
21 */
22public class Dimension2D {
23  public double height;
24  public double width;
25  public Dimension2D() {
26    width = 0.0;
27    height = 0.0;
28}
29  public Dimension2D(double width, double height) {
30    this.width = width;
31    this.height = height;
32  }
33  /**
34   * Returns the width.
35   *
36   * @return the width
37   */
38  public double getWidth() {
39    return width;
40  }
41 
42  /**
43   * Returns the height.
44   *
45   * @return the height
46   */
47  public double getHeight() {
48    return height;
49  }
50 
51  /**
52   * Set the size to the specified width
53   * and height.
54   * This method is included for completeness, to parallel the
55   * getSize method of <code>Component</code>.
56   * @param width  the new width
57   * @param height  the new height
58   */
59  public void setSize(double width, double height) {
60    this.width = width;
61    this.height = height;
62  }
63 
64  /**
65   * Set the size to match the specified size.
66   * This method is included for completeness, to parallel the
67   * getSize method of <code>Component</code>.
68   * @param d  the new size
69   */
70  public void setSize(Dimension2D d) {
71    setSize(d.getWidth(), d.getHeight());
72  }
73  /**
74   *
75   */
76  public String toString() {
77    return getClass().getName() + "[width=" + width + ",height=" + height +
78"]";
79  }
80  /**
81   * Test for equality.  Both width and height must be equal to be
82   * true.
83   */
84  public boolean equals(Dimension2D d) {
85    return (width == d.width && height == d.height);
86  }
87}
Note: See TracBrowser for help on using the repository browser.