diff --git a/esempioJoin/Main.java b/src/join/Main.java similarity index 97% rename from esempioJoin/Main.java rename to src/join/Main.java index e72fbbfe02b655bd582d88c725096e3894f9f3e6..14157f3c2584cb1454b259a6e4f088f030225ed5 100755 --- a/esempioJoin/Main.java +++ b/src/join/Main.java @@ -1,3 +1,5 @@ +package join; + import java.util.ArrayList; import java.util.Random; @@ -22,6 +24,7 @@ public class Main { for (Thread t : threads) { t.join(); } + System.out.println("...All thread finished!"); } diff --git a/esempioJoin/MyThread.java b/src/join/MyThread.java similarity index 96% rename from esempioJoin/MyThread.java rename to src/join/MyThread.java index 3316d3a43b11840f5e54bfbca907ac7f4fa2a5f1..3c12a8311634585ee9df7d94f3c5457f5571ce3d 100755 --- a/esempioJoin/MyThread.java +++ b/src/join/MyThread.java @@ -1,3 +1,5 @@ +package join; + import java.util.Random; public class MyThread extends Thread { diff --git a/producerConsumer/Consumer.java b/src/producerConsumer/Consumer.java similarity index 92% rename from producerConsumer/Consumer.java rename to src/producerConsumer/Consumer.java index 69a30fdfdb870fab0ca3a49200ab7ebda37217a7..794b2b858a37bb096155cf9b5f20cbee5bec74e3 100644 --- a/producerConsumer/Consumer.java +++ b/src/producerConsumer/Consumer.java @@ -1,3 +1,5 @@ +package producerConsumer; + public class Consumer implements Runnable { private final Queue queue; diff --git a/producerConsumer/Main.java b/src/producerConsumer/Main.java similarity index 93% rename from producerConsumer/Main.java rename to src/producerConsumer/Main.java index 0d260c4c3a760402e8e4387600914b27b914c3e8..1466609b102e87b607667e434071f4532eab8e65 100644 --- a/producerConsumer/Main.java +++ b/src/producerConsumer/Main.java @@ -1,3 +1,5 @@ +package producerConsumer; + public class Main { public static void main(String[] args) { Queue q = new Queue(); diff --git a/producerConsumer/Producer.java b/src/producerConsumer/Producer.java similarity index 95% rename from producerConsumer/Producer.java rename to src/producerConsumer/Producer.java index ccb0234fb24de9a04e29bb809929f656161e3346..7984871342acbd1e9eca847c49b9d5a5647dbdc4 100644 --- a/producerConsumer/Producer.java +++ b/src/producerConsumer/Producer.java @@ -1,3 +1,5 @@ +package producerConsumer; + public class Producer implements Runnable { private final String id; diff --git a/producerConsumer/Queue.java b/src/producerConsumer/Queue.java similarity index 94% rename from producerConsumer/Queue.java rename to src/producerConsumer/Queue.java index 45a678d5206b44582f97e17948c8584510d39310..500a1312638abf58ac524aed62eda7e91b0d7477 100644 --- a/producerConsumer/Queue.java +++ b/src/producerConsumer/Queue.java @@ -1,3 +1,5 @@ +package producerConsumer; + import java.util.ArrayList; public class Queue { diff --git a/producerConsumerUnsynced/Consumer.java b/src/producerConsumerUnsynced/Consumer.java similarity index 90% rename from producerConsumerUnsynced/Consumer.java rename to src/producerConsumerUnsynced/Consumer.java index 678475cfc02f6805d3a243af9a332648515de5f8..c9d3c1de348f9cdc65da430f564e730d700d17ed 100644 --- a/producerConsumerUnsynced/Consumer.java +++ b/src/producerConsumerUnsynced/Consumer.java @@ -1,3 +1,5 @@ +package producerConsumerUnsynced; + public class Consumer implements Runnable { private final Queue queue; diff --git a/producerConsumerUnsynced/Main.java b/src/producerConsumerUnsynced/Main.java similarity index 88% rename from producerConsumerUnsynced/Main.java rename to src/producerConsumerUnsynced/Main.java index 28c8c031bac9f12bda39452dcc481ec2316a42e6..2f402904e8d45a033406db8ebc4bf6f266d1e882 100644 --- a/producerConsumerUnsynced/Main.java +++ b/src/producerConsumerUnsynced/Main.java @@ -1,3 +1,5 @@ +package producerConsumerUnsynced; + public class Main { public static void main(String[] args) { Queue q = new Queue(); diff --git a/producerConsumerUnsynced/Producer.java b/src/producerConsumerUnsynced/Producer.java similarity index 94% rename from producerConsumerUnsynced/Producer.java rename to src/producerConsumerUnsynced/Producer.java index 73f672e405a3da58efebde13a5532485d1d506a1..88dcd3349ab0c2b0bbf633adced648b46b82eaaa 100644 --- a/producerConsumerUnsynced/Producer.java +++ b/src/producerConsumerUnsynced/Producer.java @@ -1,3 +1,5 @@ +package producerConsumerUnsynced; + public class Producer implements Runnable { private final String id; diff --git a/producerConsumerUnsynced/Queue.java b/src/producerConsumerUnsynced/Queue.java similarity index 93% rename from producerConsumerUnsynced/Queue.java rename to src/producerConsumerUnsynced/Queue.java index 430089a53fbe5639a2ac604eefe14d8057754ca4..7c923d19e6381cbde163ab3e194b6459ccaeb9b3 100644 --- a/producerConsumerUnsynced/Queue.java +++ b/src/producerConsumerUnsynced/Queue.java @@ -1,3 +1,5 @@ +package producerConsumerUnsynced; + import java.util.ArrayList; //Esempio di coda condivisa che non usa wait e notify diff --git a/semaphore/Main.java b/src/semaphore/Main.java similarity index 92% rename from semaphore/Main.java rename to src/semaphore/Main.java index 8fd988c4f5936bd579bd3c4ca373f88ef9d1d28a..7e8de14b8f7cfe634e5aaac8cd6d4a50bfb925a0 100755 --- a/semaphore/Main.java +++ b/src/semaphore/Main.java @@ -1,7 +1,8 @@ +package semaphore; + import java.util.ArrayList; import java.util.Random; -//Utilizzo di un semaforo "fatto a " public class Main { public static void main(String arg[]) throws Exception { Random r = new Random(); diff --git a/semaphore/MyThread.java b/src/semaphore/MyThread.java similarity index 97% rename from semaphore/MyThread.java rename to src/semaphore/MyThread.java index 7446f035da354cdc004c4da8dfd77901b91ca328..80841e795f0950aa7cfb5fcea77506f3ca3dbc21 100755 --- a/semaphore/MyThread.java +++ b/src/semaphore/MyThread.java @@ -1,3 +1,5 @@ +package semaphore; + import java.util.Random; public class MyThread extends Thread { diff --git a/semaphore/Semaphore.java b/src/semaphore/Semaphore.java similarity index 87% rename from semaphore/Semaphore.java rename to src/semaphore/Semaphore.java index 1ca34074a91bac91165e21463c2bb7d50728d43d..a6ea59dbee8396627925036764c83921f922deb0 100755 --- a/semaphore/Semaphore.java +++ b/src/semaphore/Semaphore.java @@ -1,7 +1,7 @@ -//Classe che implementa tramite wait e notify un Semaforo. +package semaphore;//Classe che implementa tramite wait e notify un Semaforo. //Se non vi ricordate cosa sia un semaforo, google is your best friend. -public class Semaphore extends Thread { +public class Semaphore { private int maxNumber; //numero massimo di thread private int threadsIn; //conteggio dei thread nell'area critica diff --git a/semaphoreAPI/Main.java b/src/semaphoreAPI/Main.java similarity index 96% rename from semaphoreAPI/Main.java rename to src/semaphoreAPI/Main.java index f8b3a59c54bd47a2bcaa11fce1e747e7d9069395..cbaee26891a53338c27765a43214e9eec5453814 100755 --- a/semaphoreAPI/Main.java +++ b/src/semaphoreAPI/Main.java @@ -1,3 +1,5 @@ +package semaphoreAPI; + import java.util.Random; import java.util.Vector; import java.util.concurrent.Semaphore; diff --git a/semaphoreAPI/MyThread.java b/src/semaphoreAPI/MyThread.java similarity index 97% rename from semaphoreAPI/MyThread.java rename to src/semaphoreAPI/MyThread.java index c8892687d0dc36ed5a31c53410cbb6b99b5edfd5..12ca0cef3669b4161ab0335658dd7d05cac5fbc6 100755 --- a/semaphoreAPI/MyThread.java +++ b/src/semaphoreAPI/MyThread.java @@ -1,3 +1,5 @@ +package semaphoreAPI; + import java.util.Random; import java.util.concurrent.Semaphore;