Compute the tag prefix to be used for this connection. Start with "A" - "Z", then "AA" - "ZZ", and finally "AAA" - "ZZZ". Wrap around after that.
(Properties props, String prefix)
| 149 | * Wrap around after that. |
| 150 | */ |
| 151 | private String computePrefix(Properties props, String prefix) { |
| 152 | // XXX - in case someone depends on the tag prefix |
| 153 | if (PropUtil.getBooleanProperty(props, |
| 154 | prefix + ".reusetagprefix", false)) |
| 155 | return "A"; |
| 156 | // tag prefix, wrap around after three letters |
| 157 | int n = tagNum.getAndIncrement() % (26*26*26 + 26*26 + 26); |
| 158 | String tagPrefix; |
| 159 | if (n < 26) |
| 160 | tagPrefix = new String(new char[] { (char)('A' + n) }); |
| 161 | else if (n < (26*26 + 26)) { |
| 162 | n -= 26; |
| 163 | tagPrefix = new String(new char[] { |
| 164 | (char)('A' + n/26), (char)('A' + n%26) }); |
| 165 | } else { |
| 166 | n -= (26*26 + 26); |
| 167 | tagPrefix = new String(new char[] { |
| 168 | (char)('A' + n/(26*26)), |
| 169 | (char)('A' + (n%(26*26))/26), |
| 170 | (char)('A' + n%26) }); |
| 171 | } |
| 172 | return tagPrefix; |
| 173 | } |
| 174 | |
| 175 | /** |
| 176 | * Constructor for debugging. |
no test coverage detected