229 }
230
231 /**
232 * Return subtree depth of this name for purposes of determining
233 * NameConstraints minimum and maximum bounds.
234 *
235 * @returns distance of name from root
236 * @throws UnsupportedOperationException if not supported for this name type
237 */
238 public int subtreeDepth() throws UnsupportedOperationException {
239 String subtree=name;
240 int i=1;
241
242 /* strip off name@ portion */
243 int atNdx = subtree.lastIndexOf('@');
244 if (atNdx >= 0) {
245 i++;
246 subtree=subtree.substring(atNdx+1);
247 }
248
249 /* count dots in dnsname, adding one if dnsname preceded by @ */
250 for (; subtree.lastIndexOf('.') >= 0; i++) {
251 subtree=subtree.substring(0,subtree.lastIndexOf('.'));
252 }
253
254 return i;
255 }
256 }
|
229 }
230
231 /**
232 * Return subtree depth of this name for purposes of determining
233 * NameConstraints minimum and maximum bounds.
234 *
235 * @returns distance of name from root
236 * @throws UnsupportedOperationException if not supported for this name type
237 */
238 public int subtreeDepth() throws UnsupportedOperationException {
239 String subtree=name;
240 int i=1;
241
242 /* strip off name@ portion */
243 int atNdx = subtree.lastIndexOf('@');
244 if (atNdx >= 0) {
245 i++;
246 subtree=subtree.substring(atNdx+1);
247 }
248
249 /* count dots in DNSName, adding one if DNSName preceded by @ */
250 for (; subtree.lastIndexOf('.') >= 0; i++) {
251 subtree=subtree.substring(0,subtree.lastIndexOf('.'));
252 }
253
254 return i;
255 }
256 }
|