View Javadoc

1   /*
2    * This file is part of NetPisteur.
3    * 
4    * Copyright 2001-2002 : Olivier CORNEC, David BOUANCHEAU, Loic LOPEZ,
5    *                       Gaetan BOUDARD, Mael LE LANNOU, Julien ROBINEAU
6    * 
7    * Copyright 2002-2003 : Olivier BRIENS, Simon DEZE, Florence FRIGOULT,
8    *                       Olivier JOURNEAULT, Francois MARTINIER, Damien RAUDE-MORVAN
9    * 
10   * Copyright 2004-2007 : Damien RAUDE-MORVAN
11   * 
12   * NetPisteur is free software; you can redistribute it and/or modify
13   * it under the terms of the GNU General Public License as published by
14   * the Free Software Foundation; either version 2 of the License, or
15   * (at your option) any later version.
16   *
17   * NetPisteur is distributed in the hope that it will be useful,
18   * but WITHOUT ANY WARRANTY; without even the implied warranty of
19   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20   * GNU General Public License for more details.
21   *
22   * You should have received a copy of the GNU General Public License
23   * along with NetPisteur; if not, write to the Free Software
24   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
25   *
26   */
27  package com.drazzib.netpisteur.monitor;
28  
29  import java.util.Calendar;
30  import java.util.GregorianCalendar;
31  
32  /**
33   * Represents the placement at a given moment
34   * 
35   * @author NetPisteur Team
36   */
37  public class Placement {
38  
39  	// /////////////////////////////////////
40  	// attributes
41  
42  	/**
43  	 * Represents ...
44  	 * 
45  	 */
46  	// mouse's positions
47  	private int x;
48  
49  	private int y;
50  
51  	// date of the mouse's positions
52  	private GregorianCalendar date;
53  
54  	// /////////////////////////////////////
55  	// associations
56  
57  	/**
58  	 * built a Placement object with 3 parameters (x-coordinate , y-coordinate
59  	 * and * the date of this placment)
60  	 * 
61  	 * @param abs
62  	 *            x-position
63  	 * @param ord
64  	 *            y-position
65  	 * @param maDate
66  	 *            date of mouse's position
67  	 */
68  
69  	public Placement(int abs, int ord, GregorianCalendar maDate) {
70  		this.x = abs;
71  		this.y = ord;
72  		this.date = maDate;
73  
74  	} // Placement()
75  
76  	// /////////////////////////////////////
77  	// access methods for attributes
78  
79  	/**
80  	 * return x-coordinate
81  	 * 
82  	 * @return x-coordinate
83  	 */
84  
85  	public int getAbs() {
86  
87  		return this.x;
88  
89  	} // getAbs()
90  
91  	/**
92  	 * return y-coordinate
93  	 * 
94  	 * @return y-coordinate
95  	 */
96  
97  	public int getOrd() {
98  
99  		return this.y;
100 
101 	} // getOrd()
102 
103 	/**
104 	 * return the date of mouse's position
105 	 * 
106 	 * @return date of mouse's positions
107 	 */
108 
109 	public GregorianCalendar getDate() {
110 
111 		return this.date;
112 
113 	} // getDate()
114 
115 	/**
116 	 * get the time's hour when someone clicks on the mouse
117 	 * 
118 	 * @return the hours when it is clicked
119 	 */
120 	public int getHours() {
121 		return this.date.get(Calendar.HOUR_OF_DAY);
122 	} // getDateHours'end
123 
124 	/**
125 	 * get the time's minute when someone clicks on the mouse
126 	 * 
127 	 * @return the minutes when it is clicked
128 	 */
129 	public int getMinutes() {
130 		return this.date.get(Calendar.MINUTE);
131 	} // getDateMinutes'end
132 
133 	/**
134 	 * get the time's second when someone clicks on the mouse
135 	 * 
136 	 * @return the seconds when it is clicked
137 	 * 
138 	 */
139 	public int getSeconds() {
140 		return this.date.get(Calendar.SECOND);
141 	} // getDateSeconds'end
142 
143 	/**
144 	 * mouse's position in a String
145 	 * 
146 	 * @return a string with mouse's positions
147 	 * 
148 	 */
149 
150 	public String getPosition() {
151 		String maPosition;
152 		maPosition = this.x + " ; " + this.y; //$NON-NLS-1$
153 
154 		return maPosition;
155 
156 	} // getPosition()
157 
158 } // end Placement class
159