package ca.ualberta.cs.bkhunter_notes;

import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;


public class ClaimList implements Serializable {
	
	
	/**
	 * claimList serialization ID
	 */
	private static final long serialVersionUID = -5279760708764549823L;
	
	protected ArrayList<Claim> claimList = null;
	protected transient ArrayList<Listener> listeners = null;
	
	public ClaimList() {
		
		this.claimList = new ArrayList<Claim>();
		this.listeners = new ArrayList<Listener>();
		
	}
	private ArrayList<Listener> getListeners() {
		if (listeners == null) {
			listeners = new ArrayList<Listener>();
		}
		return listeners;
	}
	public Collection<Claim> getClaims() {
		
		return this.claimList;
		
	}
	
	public void addClaim(Claim c) {
	
		this.claimList.add(c);
	}
	
	public void removeClaim(Claim c) {
	
		this.claimList.remove(c);
		notifyListeners();
	}
	
	public int size() {
		return claimList.size();
	}
	
	public boolean contains(Claim c) {
		return false;
	}
	
	public void notifyListeners() {
		
		for (Listener listener : getListeners())
		{
			listener.update();
		}

		
	}
	
	public void addListener(Listener L) {
		
		this.getListeners().add(L);
	}
	
	public void removeListener(Listener L) {
		this.getListeners().remove(L);
	}
	
}

@@ -148,17 +148,138 @@
 ction;%0A%0A
+// This class is used to keep a list of all claims%0A// which is useful for adapting them to a listview%0A// and sorting etc.
 %0A
-
 public c
@@ -662,16 +662,109 @@
 ;%0A%09%09%0A%09%7D%0A
+%09%0A%09// This code is from my Serialization implementation%0A%09// which at the moment doesn't work%0A
 %09private
@@ -1234,26 +1234,95 @@
 n false;%0A%09%7D%0A
-
 %09%0A
+%09// Listeners are used update a listview on line%0A%09// in an activity.%0A
 %09public void

Update ClaimList.java