public int compareTo(PostingsAndFreq other) {if (position != other.position) {return position - other.position;}if (nTerms != other.nTerms) {return nTerms - other.nTerms;}if (nTerms == 0) {return 0;}for (int i=0; i<terms.length; i++) {int res = terms[i].compareTo(other.terms[i]);if (res!=0) return res;}return 0;}
public virtual int CompareTo(PostingsAndFreq other){if (docFreq != other.docFreq){return docFreq - other.docFreq;}if (position != other.position){return position - other.position;}if (nTerms != other.nTerms){return nTerms - other.nTerms;}if (nTerms == 0){return 0;}for (int i = 0; i < terms.Length; i++){int res = terms[i].CompareTo(other.terms[i]);if (res != 0){return res;}}return 0;}