Skip to content

Instantly share code, notes, and snippets.

@RossignolVincent
Created January 3, 2017 16:01
Show Gist options
  • Save RossignolVincent/d2cf1e0d3b63a8da2de1e4e799454e1b to your computer and use it in GitHub Desktop.
Save RossignolVincent/d2cf1e0d3b63a8da2de1e4e799454e1b to your computer and use it in GitHub Desktop.
EvilCorp Vincent Rossignol
package ESGI;
/**
* Created by Vincent on 03/01/2017.
*/
public class Affectation {
Worker worker;
String date;
String task;
public Affectation(Worker worker, String date, String task) {
this.worker = worker;
this.date = date;
this.task = task;
}
}
package ESGI;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Vincent on 03/01/2017.
*/
public class Factory {
public List<Affectation> list;
public Factory () {
list = new ArrayList<Affectation>();
}
private void affect(Worker worker, String date, String task){
for(Affectation a : list){
if(worker.name.equals(a.worker.name)){
a.date = date;
a.task = task;
return;
}
}
list.add(new Affectation(worker, date, task));
}
public void task1(Worker worker, String date){
affect(worker, date, "task1");
}
public void task2(Worker worker, String date){
affect(worker, date, "task2");
}
public void task3(Worker worker, String date){
affect(worker, date, "task3");
}
}
package ESGI;
/**
* Created by Vincent on 03/01/2017.
*/
public class Worker {
String name;
public Worker() {
}
public void work(){}
public void eat(){}
public void sleep(){}
public void other(){}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment