Fix equals() for ListRelation

ListRelation delegates equals() to List, which would check
types using getClass(). Changed to use instanceof, and made
the delegation explicit.
Fix lots of broken equals() + doc Type compareTo

* equals() would fail on null arguments
* document that compareTo() on types is inconsistent with equals()
Simplify relation types

* Set and list relation types don't need to store their own
  tupleType, since the superclass already stores the element
  type
* This means equals(), hashCode(), lub(), etc can be inherited
Refactor to avoid access to private data of outer classes

(This is apparently slightly less efficient, since the compiler
has to work around the access by creating a special method.)
Fix list relation bug

The BottomUpTransformer was confusing list relations and set
relations (thanks, FindBugs!)

Also, ListRelation stored its type in field that was never read.
Fix unsafe negation of compareTo
Iterate using entry sets instead of key sets
Remove unnecessary code; set compliance level to 1.6
Fix completely broken XMLWriter test
Check for incomplete reads in BinaryReader