KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > clif > scenario > util > isac > loadprofile > gui > Size


1 /*
2  * CLIF is a Load Injection Framework
3  * Copyright (C) 2004 France Telecom R&D
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * CLIF
20  *
21  * Contact: clif@objectweb.org
22  */

23 package org.objectweb.clif.scenario.util.isac.loadprofile.gui;
24
25 import org.objectweb.clif.scenario.util.isac.loadprofile.Point;
26
27 /**
28  * This element is a size, it is composed of two int describing the width and
29  * the height
30  *
31  * @author JC Meillaud
32  * @author A Peyrard
33  */

34 public class Size {
35     private int width;
36     private int height;
37
38     /**
39      * Build a new null size
40      */

41     public Size() {
42         this.width = 0;
43         this.height = 0;
44     }
45
46     /**
47      * Build a new size with the specified values
48      * @param w
49      * The width to set
50      * @param h
51      * The height to set
52      */

53     public Size(int w, int h) {
54         this.width = w;
55         this.height = h;
56     }
57
58     /**
59      * @return Returns the heigth.
60      */

61     public int getHeight() {
62         return height;
63     }
64     /**
65      * @param heigth
66      * The heigth to set.
67      */

68     public void setHeight(int heigth) {
69         this.height = heigth;
70     }
71     /**
72      * @return Returns the width.
73      */

74     public int getWidth() {
75         return width;
76     }
77     /**
78      * @param width
79      * The width to set.
80      */

81     public void setWidth(int width) {
82         this.width = width;
83     }
84     
85     /**
86      * Get the point on the down right corner of the rectangle of the current size
87      * @return The point
88      */

89     public Point toPoint() {
90         return new Point(this.width, this.height) ;
91     }
92     
93     /**
94      * Print the size
95      */

96     public String JavaDoc toString() {
97         String JavaDoc result = "{ " + width + " , " + height + " }" ;
98         
99         return result ;
100     }
101 }
Popular Tags