/** * A philosopher who thinks, gets hungry and eats with two forks, * picking up the right fork first. * * @author Franck van Breugel */ public class RightHandedPhilosopher extends Philosopher { /** * Initialize this philosopher with the given id and table. * * @param id the id of this philosopher. * @param table the table of this philosopher. */ public RightHandedPhilosopher(int id, Table table) { super(id, table); } /** * Life of this philosopher. */ public void run() { while (true) { // think // becomes hungry super.table.pickUp(super.id); super.table.pickUp((super.id + 1) % 5); // eat super.table.putDown(super.id); super.table.putDown((super.id + 1) % 5); } } }