View Javadoc
1   package civitas.common.ballotdesign;
2   
3   import org.springframework.stereotype.Controller;
4   
5   import civitas.common.CommonConstants;
6   
7   @Controller
8   public class GetNthContext implements CommonConstants {
9   
10  	public String apply(final BallotDesign that, final int n) {
11  		int c = 0;
12  		int k = that.candidates.length;
13  		for (int i = 0; i < k; i++) {
14  			for (int j = i + 1; j < k; j++) {
15  				if (n == c) {
16  					return KIND + i + ":" + j;
17  				}
18  				c++;
19  			}
20  		}
21  		return null;
22  	}
23  }