public static HashSet<CharacterRange> consolidateAdjacentRanges(Iterable<CharacterRange> origSet)
	{
		TreeSet<CharacterRange> original = new TreeSet<CharacterRange>();
		HashSet<CharacterRange> rv = new HashSet<CharacterRange>();
		for(CharacterRange cr : origSet) original.add(cr);
		CharacterRange current = null;
		for(CharacterRange cr : original)
		{
			if(current == null) current = cr;
			else if(cr.contains(current) || current.lastChar() + 1 == cr.firstChar())
			{
				current = new CharacterRange((char) Math.min(current.firstChar(),cr.firstChar()),
						                     (char) Math.max(current.lastChar(),cr.lastChar()));
			}
			else
			{
				rv.add(current);
				current = cr;
			}
		}
		rv.add(current);
		return rv;
	}