private static SetOfCharsSyntax operate(SetOperation operation,TreeMap<Character,Byte> extrema)
	{
		boolean leftOn = false,leftTurnsOn = false,leftTurnsOff = false;
		boolean rightOn = false,rightTurnsOn = false,rightTurnsOff = false;
		char[][] newCanonicalRanges = new char[extrema.size()][2];
		int i = 0;
		for(char extremum : extrema.keySet())
		{
			leftTurnsOff = ((extrema.get(extremum) & Masks.LEFT_TURNS_OFF) != 0);
			leftTurnsOn = ((extrema.get(extremum) & Masks.LEFT_TURNS_ON) != 0);
			rightTurnsOff = ((extrema.get(extremum) & Masks.RIGHT_TURNS_OFF) != 0);
			rightTurnsOn = ((extrema.get(extremum) & Masks.RIGHT_TURNS_ON) != 0);
						
			if(operation.onLogic(leftOn,rightOn,leftTurnsOn,rightTurnsOn))
			{
				if(i > 0 && (extremum - newCanonicalRanges[i-1][1]) <= 1) i--;
				else newCanonicalRanges[i][0] = extremum;
			}

			// DEBUG-X-BEGIN
			//System.err.print(extremum + " " + leftOn + " " + rightOn);
			// DEBUG-X-END

			leftOn = leftOn || leftTurnsOn;
			rightOn = rightOn || rightTurnsOn;

			
			if(operation.offLogic(leftOn,rightOn,leftTurnsOff,rightTurnsOff))
			{
				newCanonicalRanges[i][1] = extremum;
				i++;
			}
			
			leftOn = leftOn && !leftTurnsOff;
			rightOn = rightOn && !rightTurnsOff;
			
			// DEBUG-X-BEGIN
			//System.err.println(" " + leftOn + " " + rightOn);
			// DEBUG-X-END
		}

		// DEBUG-X-BEGIN
		// for(int j = 0;j < i;j++) System.err.println(newCanonicalRanges[j][0] + " " + newCanonicalRanges[j][1]);
		// System.err.println(i + " " + newCanonicalRanges.length);
		// DEBUG-X-END

		return new SetOfCharsSyntax(clipRanges(newCanonicalRanges,i),true);
	}