code: public int compareTo(Rule o) {
      	
      	int i; 
          
          i = doCompare(this.getSurt(), o.getSurt());
          
          if (i != 0) {
          	return i;
          }
          
          // exact matches come after non-exact
      	i = doCompare(this.getExactMatch(), o.getExactMatch());
      	
          if (i != 0) {
          	return i;
          }
          
      	// Compare by accessGroup, specific accessGroups take precedence
      	i = doCompare(this.getWho(), o.getWho());
          
          if (i != 0) {
          	return i;
          }         
  
          // if we're still equal try capture date start
      	i = doCompare(this.getCaptureStart(), o.getCaptureStart());
          
          if (i != 0) {
          	return i;
          }    	
  
          // and retrieval date
      	i = doCompare(this.getRetrievalStart(), o.getRetrievalStart());
  
          if (i != 0) {
          	return i;
          }    	
      	
      	i = doCompare(this.getSecondsSinceCapture(), o.getSecondsSinceCapture());
              
          return i;
      }
docs: /*
  Rules are sorted in descending order of "specificity".
  So we order first by SURT, exact-match,
  then group, then policy.