Class Worker
java.lang.Object
org.episteme.social.sociology.Role
org.episteme.social.economics.EconomicAgent
org.episteme.social.economics.Worker
- All Implemented Interfaces:
Serializable, Commented, ComprehensiveIdentification, Identified<Identification>, Named, Temporal<TimeCoordinate>
- Direct Known Subclasses:
Artist, Doctor, Judge, JuryMember, Lawyer, Prosecutor
Represents a worker within an
Organization.
A worker is an EconomicAgent that has a specific job function,
earns an income, and exists within a professional hierarchy of chiefs and
subalterns.
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
- See Also:
-
Field Summary
Fields inherited from class Role
CLIENT, OBSERVER, SERVER, SUPERVISOR -
Constructor Summary
ConstructorsConstructorDescriptionWorker(Individual individual, Organization organization, String function, Money annualIncome) Creates a new worker.Worker(Individual individual, WorkSituation workSituation, String function, Organization organization) Legacy constructor for work situation compatibility. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSubaltern(Worker child) Adds an immediate subordinate.booleanextractTree(Worker w1, Worker w2) Creates a tree structure representing the hierarchy between two workers.Returns all subordinates at any depth.Returns the annual income of this worker.Returns an unmodifiable set of immediate supervisors.static WorkergetCommonRoot(Worker w1, Worker w2) Finds the lowest common supervisor for two workers.Returns workers having the same immediate supervisors.Returns the set of workers at the top of the hierarchy for this worker.getLineage(Worker root, Worker target) Returns the workers path from a root to a target worker.Returns the organization this worker is employed by.Returns an unmodifiable set of immediate subordinates.getSubalternsAtLevelK(int k) Returns all subordinates at a specific depth level.Returns the number of hours worked per year.booleanhasChief()Checks if this worker has any immediate supervisors.booleanhasChild()Checks if this worker has any subordinates.booleanChecks if a specific worker is an immediate subordinate.booleanhasDistantSubaltern(Worker target) Checks if a worker is a subordinate at any depth.inthashCode()voidremoveSubaltern(Worker child) Removes an immediate subordinate.voidChange a supervisor for this worker.voidsetAnnualIncome(Money annualIncome) Sets the annual income for this worker.voidsetFunction(String function) Sets the job function description.voidsetOrganization(Organization organization) Sets the organization for this worker.voidsetSubalterns(Set<Worker> subalterns) Sets the set of immediate subordinates.voidsetWorkedHours(double workedHours) Sets the number of hours worked per year.voidsetWorkedHours(Quantity<Time> workedHours) Sets the number of hours worked per year.Methods inherited from class EconomicAgent
addBelonging, getBelongings, getCommunity, getWallet, removeBelonging, setBelongings, setWalletMethods inherited from class Role
getId, getIndividual, getKind, getSituation, getTraits, getWhen, setKind, setTimestamp, toStringMethods inherited from interface Commented
getComments, getTrait, setCommentsMethods inherited from interface ComprehensiveIdentification
getName, getTrait, setName, setTrait
-
Constructor Details
-
Worker
public Worker(Individual individual, Organization organization, String function, Money annualIncome) Creates a new worker.- Parameters:
individual- the underlying biological or social individual.organization- the organization they work for.function- their job title or function.annualIncome- their yearly salary.
-
Worker
public Worker(Individual individual, WorkSituation workSituation, String function, Organization organization) Legacy constructor for work situation compatibility.
-
-
Method Details
-
setFunction
Sets the job function description.- Parameters:
function- the job title or description.- Throws:
IllegalArgumentException- if function is null or empty.
-
getAnnualIncome
Returns the annual income of this worker.- Returns:
- the yearly salary.
-
setAnnualIncome
Sets the annual income for this worker.- Parameters:
annualIncome- the new yearly salary.- Throws:
IllegalArgumentException- if income is null.
-
getWorkedHours
-
setWorkedHours
-
setWorkedHours
public void setWorkedHours(double workedHours) Sets the number of hours worked per year.- Parameters:
workedHours- the new hour count in double (converted to Quantity).
-
hasChild
public boolean hasChild()Checks if this worker has any subordinates.- Returns:
trueif subalterns set is not empty.
-
hasChild
Checks if a specific worker is an immediate subordinate.- Parameters:
child- the worker to check.- Returns:
trueif the worker is in the subalterns set.
-
getSubalterns
-
setSubalterns
Sets the set of immediate subordinates.- Parameters:
subalterns- the subordinates to set.- Throws:
IllegalArgumentException- if subalterns set is null.
-
addSubaltern
Adds an immediate subordinate.- Parameters:
child- the worker to add.- Throws:
IllegalArgumentException- if the child is already a supervisor or self.
-
removeSubaltern
Removes an immediate subordinate.- Parameters:
child- the worker to remove.
-
hasChief
public boolean hasChief()Checks if this worker has any immediate supervisors.- Returns:
trueif chiefs set is not empty.
-
getChiefs
-
reparent
-
getLeaders
-
getCoWorkers
-
getCommonRoot
-
getLineage
-
extractTree
-
getAllSubalterns
-
getSubalternsAtLevelK
-
hasDistantSubaltern
Checks if a worker is a subordinate at any depth.- Parameters:
target- the worker to search for.- Returns:
trueif found in the hierarchy.
-
equals
-
hashCode
-
getOrganization
Returns the organization this worker is employed by.- Returns:
- the organization.
-
setOrganization
Sets the organization for this worker.- Parameters:
organization- the new employer.
-