[exo-jcr-commits] exo-jcr SVN: r4270 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Apr 21 14:32:10 EDT 2011
Author: nfilotto
Date: 2011-04-21 14:32:09 -0400 (Thu, 21 Apr 2011)
New Revision: 4270
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/QPath.java
Log:
EXOJCR-1314: Improve QPath.isDescendantOf by using reverse order
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/QPath.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/QPath.java 2011-04-21 14:58:32 UTC (rev 4269)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/QPath.java 2011-04-21 18:32:09 UTC (rev 4270)
@@ -173,7 +173,7 @@
if (names.length - ancestorNames.length <= 0)
return false;
- for (int i = 0; i < ancestorNames.length; i++)
+ for (int i = ancestorNames.length - 1; i >= 0; i--)
{
if (!names[i].equals(ancestorNames[i]))
return false;
@@ -191,13 +191,11 @@
{
final InternalQName[] anotherNames = anotherPath.names;
- // int depthDiff = getDepth() - anotherPath.getDepth();
int depthDiff = names.length - anotherNames.length;
if (depthDiff <= 0 || (childOnly && depthDiff != 1))
return false;
- // InternalQName[] anotherNames = anotherPath.getEntries();
- for (int i = 0; i < anotherNames.length; i++)
+ for (int i = anotherNames.length - 1; i >= 0; i--)
{
if (!anotherNames[i].equals(names[i]))
return false;
More information about the exo-jcr-commits
mailing list