Formatted all files to the same standard

This commit is contained in:
matthew
2014-10-08 13:42:12 +01:00
parent 53a2a8b150
commit 3da9ad5469
151 changed files with 952 additions and 870 deletions

View File

@@ -5,9 +5,8 @@ import java.util.List;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
public class Inventory {
private int inventorySize;
private List<Item> items;
private Lock lock = new ReentrantLock();
@@ -16,17 +15,17 @@ public class Inventory {
this.inventorySize = inventorySize;
this.items = new ArrayList<Item>(inventorySize);
}
public boolean addItem(Item item){
if(items.size()<inventorySize){
public boolean addItem(Item item) {
if (items.size() < inventorySize) {
lock.lock();
try{
if(items.size()<inventorySize){
try {
if (items.size() < inventorySize) {
items.add(item);
System.out.println(Thread.currentThread());
return true;
}
}finally{
} finally {
lock.unlock();
}
}