internal CacheResult find(
XRIAuthority oAuth, int nNextSubsegment, bool bCompleteChain,
ArrayList oCachedDescriptors)
{
// if there are no new subsegments to get, just return "this", we are done
XRISubSegment oSubSegment = oAuth.getSubSegmentAt(nNextSubsegment);
if (oSubSegment == null) {
return new CacheResult(this, nNextSubsegment);
}
// also return if we can't find the next subsegment
CacheNode oNode = find(oSubSegment.ToString());
if (oNode == null) {
return new CacheResult(this, nNextSubsegment);
}
// if the found node doesn't have a cached value, potentially bail
if (
(oNode.moCacheValue == null) ||
(oNode.moCacheValue.getDescriptor() == null)) {
if (bCompleteChain) {
return new CacheResult(this, nNextSubsegment);
}
} else if (oCachedDescriptors != null) {
oCachedDescriptors.Add(oNode.moCacheValue.getDescriptor());
}
// N O T E: The direcory metaphore used here allows for directories
// to be "empty" (null moCacheValue) and still have subdirs.
//
// As we recurse up, if the returned CacheNode has an empty
// moCacheValue, we'll return "this" unless they caller does not
// allow partials.
return oNode.find(
oAuth, nNextSubsegment + 1, bCompleteChain, oCachedDescriptors);
}