KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > speedo > pobjects > collection > Employee


1 /***
2  * Julia: France Telecom's implementation of the Fractal API
3  * Copyright (C) 2001-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  * Contact: sebastien.chassandebarrioz@rd.francetelecom.com
20  *
21  * Author: S.Chassande-Barrioz
22  */

23
24 package org.objectweb.speedo.pobjects.collection;
25
26 import java.util.Collection JavaDoc;
27 import java.util.Iterator JavaDoc;
28 import java.util.ArrayList JavaDoc;
29
30 public class Employee {
31
32     public String JavaDoc name;
33
34     public Employee boss;
35
36     public Collection JavaDoc ints;
37
38     public Collection JavaDoc friends;
39
40     public Employee () {
41     }
42
43     public Employee (String JavaDoc name) {
44         this.name = name;
45         this.ints = new ArrayList JavaDoc();
46         this.friends = new ArrayList JavaDoc();
47     }
48
49     public Employee (String JavaDoc name, Employee boss) {
50         this.name = name;
51         this.boss = boss;
52         this.ints = new ArrayList JavaDoc();
53         this.friends = new ArrayList JavaDoc();
54     }
55
56     
57     public Employee getBoss() {
58         return boss;
59     }
60     public void setBoss(Employee boss) {
61         this.boss = boss;
62     }
63     public String JavaDoc getName() {
64         return name;
65     }
66     public void setName(String JavaDoc name) {
67         this.name = name;
68     }
69     public Iterator JavaDoc getInts () {
70         return ints.iterator();
71     }
72     public Collection JavaDoc getIntsCol() {
73         return ints;
74     }
75
76     public void addInt (int i) {
77         ints.add(new Integer JavaDoc(i));
78     }
79
80     public void setInts(Collection JavaDoc ints) {
81         this.ints = ints;
82     }
83
84     public void removeInt (int i) {
85         ints.remove(new Integer JavaDoc(i));
86     }
87
88     public Iterator JavaDoc getFriends () {
89         return friends.iterator();
90     }
91
92     public Collection JavaDoc getFriendsCol() {
93         return friends;
94     }
95
96     public void setFriends (Collection JavaDoc friends) {
97         this.friends = friends;
98     }
99
100     public void addFriend (Employee friend) {
101         friends.add(friend);
102     }
103
104     public void removeFriend (Employee friend) {
105         friends.remove(friend);
106     }
107
108     public String JavaDoc toString() {
109         return name;
110     }
111 }
112
Popular Tags