01: /**
02: * Speedo: an implementation of JDO compliant personality on top of JORM generic
03: * I/O sub-system.
04: * Copyright (C) 2001-2004 France Telecom R&D
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2 of the License, or (at your option) any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19: *
20: *
21: *
22: * Contact: speedo@objectweb.org
23: *
24: */package org.objectweb.speedo.pobjects.inheritance.prefetch;
25:
26: import java.util.Collection;
27: import java.util.Iterator;
28:
29: /**
30: * @author Y.Bersihand
31: */
32: public class Worker extends Employee {
33:
34: private boolean partTime;
35: private Manager mainManager;
36: private Department department;
37: private Collection days;
38:
39: public Worker(String name, int age, String company,
40: boolean partTime, Department dpt) {
41: super (name, age, company, "worker");
42: this .partTime = partTime;
43: this .department = dpt;
44: }
45:
46: public boolean isPartTime() {
47: return partTime;
48: }
49:
50: public void setPartTime(boolean partTime) {
51: this .partTime = partTime;
52: }
53:
54: public Manager getMainManager() {
55: return mainManager;
56: }
57:
58: public void setMainManager(Manager mainManager) {
59: this .mainManager = mainManager;
60: mainManager.addWorker(this );
61: }
62:
63: public String toString() {
64: String s = "Worker: Employee(" + super .toString() + "), "
65: + (partTime ? "part-time" : "full time");
66: if (mainManager != null)
67: s += ", main manager=" + mainManager.getName();
68: else
69: s += ", main manager=NULL";
70: if (department != null)
71: s += ", " + department.toString();
72: if (days != null) {
73: s += ", days=[";
74: Iterator it = days.iterator();
75: while (it.hasNext()) {
76: Day d = (Day) it.next();
77: s += d.toString() + " ";
78: }
79: s += "]";
80: }
81: return s;
82: }
83:
84: public Department getDepartment() {
85: return department;
86: }
87:
88: public void setDepartment(Department department) {
89: this .department = department;
90: }
91:
92: public Collection getDays() {
93: return days;
94: }
95:
96: public void setDays(Collection days) {
97: this.days = days;
98: }
99: }
|