(int n)
| 105 | } |
| 106 | |
| 107 | public chameneos(int n) throws InterruptedException { |
| 108 | int meetings = 0; |
| 109 | mp = new MeetingPlace(n); |
| 110 | |
| 111 | for (int i = 0; i < COLOURS.length; i++) { |
| 112 | creatures[i] = new Creature(COLOURS[i], mp); |
| 113 | creatures[i].start(); |
| 114 | } |
| 115 | |
| 116 | // wait for all threads to complete |
| 117 | for (int i = 0; i < COLOURS.length; i++) |
| 118 | creatures[i].join(); |
| 119 | |
| 120 | // sum all the meetings |
| 121 | for (int i = 0; i < COLOURS.length; i++) { |
| 122 | meetings += creatures[i].getCreaturesMet(); |
| 123 | } |
| 124 | |
| 125 | System.out.println(meetings); |
| 126 | } |
| 127 | |
| 128 | public static void main(String[] args) throws Exception { |
| 129 | if (args.length < 1) |
nothing calls this directly
no test coverage detected