
package org.javarosa.core.util;

import java.util.Vector;

/**
 * 
 * Only use for J2ME Compatible Vectors
 * 
 *  A SizeBoundVector that enforces that all member items be unique. You must
 *  implement the .equals() method of class E
 * 
 * @author wspride
 *
 */
public class SizeBoundUniqueVector<E> extends SizeBoundVector<E> {
	
	public SizeBoundUniqueVector(int sizeLimit) {
		super(sizeLimit);
	}

	/* (non-Javadoc)
	 * @see java.util.Vector#addElement(java.lang.Object)
	 */
	public synchronized void addElement(E obj) {
		if(this.size() == limit) {
			additional++;
			return;
		}
		else if(this.contains(obj)){
			return;
		}
		else {
			super.addElement(obj);
		}
	}

}
@@ -707,12 +707,262 @@
 %09%09%7D%0D%0A%09%7D%0D
+%0A%09%0D%0A%09public synchronized boolean addElementForResult(E obj) %7B%0D%0A%09%09if(this.size() == limit) %7B%0D%0A%09%09%09additional++;%0D%0A%09%09%09return true;%0D%0A%09%09%7D%0D%0A%09%09else if(this.contains(obj))%7B%0D%0A%09%09%09return false;%0D%0A%09%09%7D%0D%0A%09%09else %7B%0D%0A%09%09%09super.addElement(obj);%0D%0A%09%09%09return true;%0D%0A%09%09%7D%0D%0A%09%7D%0D
 %0A%0D%0A%7D

fix for labelling of multimedia validation error