Made Lookup::getIndirectionPath() somewhat less ridiculous.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3262 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-06-28 13:45:17 +00:00
parent be6dd8c9dc
commit b55958b062
2 changed files with 21 additions and 27 deletions

View File

@@ -238,7 +238,6 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
{
// Capture the repository.
Repository repo = lPath.getRepository();
// Otherwise we do an actual copy.
LayeredDirectoryNodeImpl newMe = null;
if (!lPath.isInThisLayer())
{

View File

@@ -22,7 +22,7 @@ import java.util.List;
/**
* This holds all the information necessary to perform operations
* on AVMNodes, and is internall structured as a list of path components
* on AVMNodes, and is structured internally as a list of path components
* from the root directory of a repository.
* @author britt
*/
@@ -258,20 +258,20 @@ class Lookup
*/
public String getIndirectionPath()
{
// The path is the underlying path of the lowest layer that is directly contained
// by the top layer that is a primary indirection node.
for (int pos = fLowestLayerIndex; pos >= fTopLayerIndex; pos--)
{
// The path is the underlying path of the lowest layer (in the path sense)
// that is directly contained by the top layer and is a primary indirection node.
int pos = fLowestLayerIndex;
AVMNode node = fComponents.get(pos).getNode();
if (node.getType() != AVMNodeType.LAYERED_DIRECTORY)
LayeredDirectoryNode oNode = null;
while (pos >= fTopLayerIndex && node.getType() != AVMNodeType.LAYERED_DIRECTORY &&
((oNode = (LayeredDirectoryNode)node).getLayerID() != fTopLayer.getLayerID() ||
!oNode.getPrimaryIndirection()))
{
continue;
pos--;
node = fComponents.get(pos).getNode();
}
LayeredDirectoryNode oNode =
(LayeredDirectoryNode)node;
if (oNode.getLayerID() == fTopLayer.getLayerID() &&
oNode.getPrimaryIndirection())
{
oNode = (LayeredDirectoryNode)node;
// We've found it.
StringBuilder builder = new StringBuilder();
builder.append(oNode.getUnderlying());
for (int i = pos + 1; i <= fPosition; i++)
@@ -281,11 +281,6 @@ class Lookup
}
return builder.toString();
}
}
// TODO This is gross. There has to be a neater way to do this.
assert false : "Not reached.";
return "bogus";
}
/**
* Get the computed indirection for the current node.