]> git.mxchange.org Git - addressbook-swing.git/blob - Addressbook/src/org/mxchange/addressbook/contact/BaseContact.java
Initial commit
[addressbook-swing.git] / Addressbook / src / org / mxchange / addressbook / contact / BaseContact.java
1 /*\r
2  * Copyright (C) 2015 Roland Haeder\r
3  *\r
4  * This program is free software: you can redistribute it and/or modify\r
5  * it under the terms of the GNU General Public License as published by\r
6  * the Free Software Foundation, either version 3 of the License, or\r
7  * (at your option) any later version.\r
8  *\r
9  * This program is distributed in the hope that it will be useful,\r
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
12  * GNU General Public License for more details.\r
13  *\r
14  * You should have received a copy of the GNU General Public License\r
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
16  */\r
17 package org.mxchange.addressbook.contact;\r
18 \r
19 import org.mxchange.addressbook.BaseFrameworkSystem;\r
20 \r
21 /**\r
22  * A general contact\r
23  *\r
24  * @author Roland Haeder\r
25  * @version 0.0\r
26  * @since 0.0\r
27  */\r
28 public class BaseContact extends BaseFrameworkSystem {\r
29     /**\r
30      * Birth day\r
31      */\r
32     private String birthday;\r
33 \r
34     /**\r
35      * Cellphone number\r
36      */\r
37     private String cellphoneNumber;\r
38 \r
39     /**\r
40      * City\r
41      */\r
42     private String city;\r
43 \r
44     /**\r
45      * Optional comments\r
46      */\r
47     private String comment;\r
48 \r
49     /**\r
50      * Companyname\r
51      */\r
52     private String companyName;\r
53 \r
54     /**\r
55      * Country code\r
56      */\r
57     private String countryCode;\r
58 \r
59     /**\r
60      * Email address\r
61      */\r
62     private String emailAddress;\r
63 \r
64     /**\r
65      * Family name\r
66      */\r
67     private String familyName;\r
68 \r
69     /**\r
70      * Fax number\r
71      */\r
72     private String faxNumber;\r
73 \r
74     /**\r
75      * Gender code of the contact: - M = Mr. (male) - F = Mrs. (female) - C =\r
76      * Company\r
77      */\r
78     private char gender;\r
79 \r
80     /**\r
81      * House number\r
82      */\r
83     private int houseNumber;\r
84 \r
85     /**\r
86      * Marker whether this contact is user's own data\r
87      */\r
88     private boolean ownContact;\r
89 \r
90     /**\r
91      * Phone number\r
92      */\r
93     private String phoneNumber;\r
94 \r
95     /**\r
96      * Street\r
97      */\r
98     private String street;\r
99 \r
100     /**\r
101      * Surname\r
102      */\r
103     private String surname;\r
104 \r
105     /**\r
106      * ZIP code\r
107      */\r
108     private int zipCode;\r
109 \r
110     /**\r
111      * No instances can be created of this class\r
112      */\r
113     protected BaseContact () {\r
114         super();\r
115     }\r
116 \r
117     /**\r
118      * Enables the flag "own data" which signals that this contact is the user's\r
119      * own data.\r
120      */\r
121     public void enableFlagOwnContact () {\r
122         this.ownContact = true;\r
123     }\r
124 \r
125     /**\r
126      * Check if contacts are same or throw an exception\r
127      *\r
128      * @param object Other possible contact class\r
129      * @return Whether both contacts are same\r
130      */\r
131     @Override\r
132     public boolean equals (Object object) {\r
133         // Try to cast\r
134         BaseContact c = (BaseContact) object;\r
135         \r
136         /*\r
137          * Now test some data @todo Definedly needs improvement\r
138          */\r
139         return ((this.getGender() == c.getGender())\r
140                 && (this.getSurname().toLowerCase().equals(c.getSurname().toLowerCase()))\r
141                 && (this.getFamilyName().toLowerCase().equals(c.getFamilyName().toLowerCase())));\r
142     }\r
143 \r
144     /**\r
145      * Birth day\r
146      *\r
147      * @return the birthday\r
148      */\r
149     public String getBirthday () {\r
150         return this.birthday;\r
151     }\r
152 \r
153     /**\r
154      * Birth day\r
155      *\r
156      * @param birthday the birthday to set\r
157      */\r
158     public void setBirthday (final String birthday) {\r
159         this.birthday = birthday;\r
160     }\r
161 \r
162     /**\r
163      * Cellphone number\r
164      *\r
165      * @return the cellphoneNumber\r
166      */\r
167     public String getCellphoneNumber () {\r
168         return this.cellphoneNumber;\r
169     }\r
170 \r
171     /**\r
172      * Cellphone number\r
173      *\r
174      * @param cellphoneNumber the cellphoneNumber to set\r
175      */\r
176     public void setCellphoneNumber (final String cellphoneNumber) {\r
177         this.cellphoneNumber = cellphoneNumber;\r
178     }\r
179 \r
180     /**\r
181      * City\r
182      *\r
183      * @return the city\r
184      */\r
185     public String getCity () {\r
186         return this.city;\r
187     }\r
188 \r
189     /**\r
190      * City\r
191      *\r
192      * @param city the city to set\r
193      */\r
194     public void setCity (final String city) {\r
195         this.city = city;\r
196     }\r
197 \r
198     /**\r
199      * Comments\r
200      *\r
201      * @return the comment\r
202      */\r
203     public String getComment () {\r
204         return this.comment;\r
205     }\r
206 \r
207     /**\r
208      * Comments\r
209      *\r
210      * @param comment the comment to set\r
211      */\r
212     public void setComment (final String comment) {\r
213         this.comment = comment;\r
214     }\r
215 \r
216     /**\r
217      * Companyname\r
218      *\r
219      * @return the companyName\r
220      */\r
221     public String getCompanyName () {\r
222         return this.companyName;\r
223     }\r
224 \r
225     /**\r
226      * Companyname\r
227      *\r
228      * @param companyName the companyName to set\r
229      */\r
230     public void setCompanyName (final String companyName) {\r
231         this.companyName = companyName;\r
232     }\r
233 \r
234     /**\r
235      * Country code\r
236      *\r
237      * @return the countryCode\r
238      */\r
239     public String getCountryCode () {\r
240         return this.countryCode;\r
241     }\r
242 \r
243     /**\r
244      * Country code\r
245      *\r
246      * @param countryCode the countryCode to set\r
247      */\r
248     public void setCountryCode (final String countryCode) {\r
249         this.countryCode = countryCode;\r
250     }\r
251 \r
252     /**\r
253      * Email address\r
254      *\r
255      * @return the emailAddress\r
256      */\r
257     public String getEmailAddress () {\r
258         return this.emailAddress;\r
259     }\r
260 \r
261     /**\r
262      * Email address\r
263      *\r
264      * @param emailAddress the emailAddress to set\r
265      */\r
266     public void setEmailAddress (final String emailAddress) {\r
267         this.emailAddress = emailAddress;\r
268     }\r
269 \r
270     /**\r
271      * Family name\r
272      *\r
273      * @return the familyName\r
274      */\r
275     public String getFamilyName () {\r
276         return this.familyName;\r
277     }\r
278 \r
279     /**\r
280      * Family name\r
281      *\r
282      * @param familyName the familyName to set\r
283      */\r
284     public void setFamilyName (final String familyName) {\r
285         this.familyName = familyName;\r
286     }\r
287 \r
288     /**\r
289      * Fax number\r
290      *\r
291      * @return the faxNumber\r
292      */\r
293     public String getFaxNumber () {\r
294         return this.faxNumber;\r
295     }\r
296 \r
297     /**\r
298      * Fax number\r
299      *\r
300      * @param faxNumber the faxNumber to set\r
301      */\r
302     public void setFaxNumber (final String faxNumber) {\r
303         this.faxNumber = faxNumber;\r
304     }\r
305 \r
306     /**\r
307      * Gender of the contact\r
308      *\r
309      * @return the gender\r
310      */\r
311     public char getGender () {\r
312         return this.gender;\r
313     }\r
314 \r
315     /**\r
316      * Gender of the contact\r
317      *\r
318      * @param gender the gender to set\r
319      */\r
320     public void setGender (final char gender) {\r
321         this.gender = gender;\r
322     }\r
323 \r
324     /**\r
325      * House number\r
326      *\r
327      * @return the houseNumber\r
328      */\r
329     public int getHouseNumber () {\r
330         return this.houseNumber;\r
331     }\r
332 \r
333     /**\r
334      * House number\r
335      *\r
336      * @param houseNumber the houseNumber to set\r
337      */\r
338     public void setHouseNumber (final int houseNumber) {\r
339         this.houseNumber = houseNumber;\r
340     }\r
341 \r
342     /**\r
343      * Phone number\r
344      *\r
345      * @return the phoneNumber\r
346      */\r
347     public String getPhoneNumber () {\r
348         return this.phoneNumber;\r
349     }\r
350 \r
351     /**\r
352      * Phone number\r
353      *\r
354      * @param phoneNumber the phoneNumber to set\r
355      */\r
356     public void setPhoneNumber (final String phoneNumber) {\r
357         this.phoneNumber = phoneNumber;\r
358     }\r
359 \r
360     /**\r
361      * Street\r
362      *\r
363      * @return the street\r
364      */\r
365     public String getStreet () {\r
366         return this.street;\r
367     }\r
368 \r
369     /**\r
370      * Street\r
371      *\r
372      * @param street the street to set\r
373      */\r
374     public void setStreet (final String street) {\r
375         this.street = street;\r
376     }\r
377 \r
378     /**\r
379      * Surname\r
380      *\r
381      * @return the surname\r
382      */\r
383     public String getSurname () {\r
384         return this.surname;\r
385     }\r
386 \r
387     /**\r
388      * Surname\r
389      *\r
390      * @param surname the surname to set\r
391      */\r
392     public void setSurname (final String surname) {\r
393         this.surname = surname;\r
394     }\r
395 \r
396     /**\r
397      * ZIP code\r
398      *\r
399      * @return the zipCode\r
400      */\r
401     public int getZipCode () {\r
402         return this.zipCode;\r
403     }\r
404 \r
405     /**\r
406      * ZIP code\r
407      *\r
408      * @param zipCode the zipCode to set\r
409      */\r
410     public void setZipCode (final int zipCode) {\r
411         this.zipCode = zipCode;\r
412     }\r
413 \r
414     /**\r
415      * Checks whether the contact is user's own data\r
416      *\r
417      * @return Own data?\r
418      */\r
419     public boolean isOwnContact () {\r
420         return this.ownContact;\r
421     }\r
422 }\r