1/*
2 *  Licensed to the Apache Software Foundation (ASF) under one or more
3 *  contributor license agreements.  See the NOTICE file distributed with
4 *  this work for additional information regarding copyright ownership.
5 *  The ASF licenses this file to You under the Apache License, Version 2.0
6 *  (the "License"); you may not use this file except in compliance with
7 *  the License.  You may obtain a copy of the License at
8 *
9 *     http://www.apache.org/licenses/LICENSE-2.0
10 *
11 *  Unless required by applicable law or agreed to in writing, software
12 *  distributed under the License is distributed on an "AS IS" BASIS,
13 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 *  See the License for the specific language governing permissions and
15 *  limitations under the License.
16 */
17/**
18 * @author Denis M. Kishenko
19 * @version $Revision$
20 */
21
22package java.awt.geom;
23
24/**
25 * The Class Dimension2D represents a size (width and height) of a geometric
26 * object. It stores double-valued data in order to be compatible with
27 * high-precision geometric operations.
28 *
29 * @since Android 1.0
30 */
31public abstract class Dimension2D implements Cloneable {
32
33    /**
34     * Instantiates a new dimension 2d with no data.
35     */
36    protected Dimension2D() {
37    }
38
39    /**
40     * Gets the width.
41     *
42     * @return the width.
43     */
44    public abstract double getWidth();
45
46    /**
47     * Gets the height.
48     *
49     * @return the height.
50     */
51    public abstract double getHeight();
52
53    /**
54     * Sets the width and height.
55     *
56     * @param width
57     *            the width.
58     * @param height
59     *            the height.
60     */
61    public abstract void setSize(double width, double height);
62
63    /**
64     * Sets the width and height based on the data of another Dimension2D
65     * object.
66     *
67     * @param d
68     *            the Dimension2D object providing the data to copy into this
69     *            Dimension2D object.
70     */
71    public void setSize(Dimension2D d) {
72        setSize(d.getWidth(), d.getHeight());
73    }
74
75    @Override
76    public Object clone() {
77        try {
78            return super.clone();
79        } catch (CloneNotSupportedException e) {
80            throw new InternalError();
81        }
82    }
83}
84