Implement compareTo methods in Term and Occurrence