/*
 * This is the Moose/GISmo set processor.
 * It only has three notations and they are prefix.
 * "+" means require set membership
 * "-" means exlude set membership
 * "|" means union between two sets.
 */

function setUnion(setA, setB) {
	var newArr = new Array();
	for(var i = 0; i < setA.length; i++) 
		newArr[newArr.length] = setA[i];

	for(var i = 0; i < setB.length; i++) 
		newArr[newArr.length] = setB[i];

	return newArr;	
}

/*
 * Set Membership Requimrent Test
 * If "require" is set to true, then the element of A must be in set B
 * If "require" is set to false, then the element of A must NOT be in A
 */
function setMembership(setA, setB, require) {
	var newArr = new Array();
	for(var a = 0; a < setA.length; a++) {
		var isInB = false;
		for(var b = 0; b < setB.length && !isInB; b++) {
			if(setA[a] == setB[b]) {
				isInB = true;
			}	
		}
		if(isInB == require) 
			newArr[newArr.length] = setA[a];
	}	
	return newArr;
}

/*
 * Short hand functions for the set Membership Test 
 */
function setRequire(A, B) {
	return setMembership(A,B,true);
}

function setExclude(A, B) {
	return setMembership(A,B,false);
}


function setProcessSetString(notation) {
	for(var i = 0; i < notation.length; i++) {
		
	}
}
