package ca.ualberta.cs.bkhunter_notes;

import java.io.IOException;


public class ClaimController {
	
	private static ClaimList claimList = null;
	
	static public ClaimList getClaimList() {
		if (claimList == null) {
			try {
				claimList = ClaimListManager.getManager().loadClaimList();
				claimList.addListener(new Listener() {
					
					@Override
					public void update() {
						saveClaimList();
						
					}
				});
				
			} catch (ClassNotFoundException e) {
				e.printStackTrace();
				throw new RuntimeException("could not deserialize");
			} catch (IOException e) {
				e.printStackTrace();
				throw new RuntimeException("could not deserialize");
			}
			claimList = new ClaimList();
		} 
		
		return claimList;
	}
	
	static public void saveClaimList() {
		try {
			ClaimListManager.getManager().saveClaimList(getClaimList());
		} catch (IOException e) {
			e.printStackTrace();
			throw new RuntimeException("could not deserialize");
		}
		claimList = new ClaimList();
	} 
		
	
	public void addIt(Claim c) {
		if (claimList == null) {
			claimList = new ClaimList();
		}
		
		claimList.addClaim(c);
	}

}

@@ -66,87 +66,330 @@
 n;%0A%0A
-%0Apublic class ClaimController %7B%0A%09%0A%09private static ClaimList claimList = null;%0A%09
+// This is a Singleton controller that is used to %0A// access the claimList and thus subsequent claims%0A// throughout the app%0Apublic class ClaimController %7B%0A%09%0A%09private static ClaimList claimList = null;%0A%09%0A%09// This constructor is geared towards serialization%0A%09// but at the moment I believe it just returns%0A%09// the claimlist 
 %0A%09st

Update ClaimController.java