Author: bcarothers
Date: 2009-07-13 11:07:52 -0400 (Mon, 13 Jul 2009)
New Revision: 1106
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicPathSegment.java
Log:
DNA-492 BasicPathSegment Checks the SNS Index in equals But Not hashcode
Applied patch that adds SNS index to the hashcode computation.
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicPathSegment.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicPathSegment.java 2009-07-13
15:01:51 UTC (rev 1105)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/BasicPathSegment.java 2009-07-13
15:07:52 UTC (rev 1106)
@@ -25,6 +25,7 @@
import net.jcip.annotations.Immutable;
import org.jboss.dna.common.text.TextEncoder;
+import org.jboss.dna.common.util.HashCode;
import org.jboss.dna.graph.property.Name;
import org.jboss.dna.graph.property.NamespaceRegistry;
import org.jboss.dna.graph.property.Path;
@@ -42,6 +43,7 @@
private static final long serialVersionUID = 4367349287846075157L;
private final Name name;
private final int index;
+ private final int hc;
/**
* @param name the segment name
@@ -51,6 +53,7 @@
assert name != null;
this.name = name;
this.index = Path.DEFAULT_INDEX;
+ hc = HashCode.compute(name, index);
}
/**
@@ -64,6 +67,7 @@
assert index >= Path.DEFAULT_INDEX;
this.name = name;
this.index = (this.isSelfReference() || this.isParentReference()) ?
Path.DEFAULT_INDEX : index;
+ hc = HashCode.compute(name, index);
}
/**
@@ -116,7 +120,7 @@
*/
@Override
public int hashCode() {
- return this.name.hashCode();
+ return hc;
}
/**
Show replies by date