Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/ikvm-fork.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjfrijters <jfrijters>2011-08-17 15:46:59 +0400
committerjfrijters <jfrijters>2011-08-17 15:46:59 +0400
commit810b64d9b333fc02cb55f0dccd5872c2d4b8ccb3 (patch)
tree76a3127cf1ad75d0c8003bec2ecea218cc7bb8c2 /openjdk/sun
parent953199ff86076814c6d2e9cee320bd498c0a3eaa (diff)
Implemented compareTo/equals/hashCode.
Diffstat (limited to 'openjdk/sun')
-rw-r--r--openjdk/sun/nio/fs/NetPath.java28
1 files changed, 25 insertions, 3 deletions
diff --git a/openjdk/sun/nio/fs/NetPath.java b/openjdk/sun/nio/fs/NetPath.java
index 8d55e60f..f6f211e0 100644
--- a/openjdk/sun/nio/fs/NetPath.java
+++ b/openjdk/sun/nio/fs/NetPath.java
@@ -237,17 +237,39 @@ final class NetPath extends AbstractPath
public int compareTo(Path other)
{
- throw new NotYetImplementedError();
+ String path2 = ((NetPath)other).path;
+ int len1 = path.length();
+ int len2 = path2.length();
+ int min = Math.min(len1, len2);
+ for (int i = 0; i < min; i++)
+ {
+ char c1 = path.charAt(i);
+ char c2 = path2.charAt(i);
+ if (c1 != c2 && Character.toUpperCase(c1) != Character.toUpperCase(c2))
+ {
+ return c1 - c2;
+ }
+ }
+ return len1 - len2;
}
public boolean equals(Object other)
{
- throw new NotYetImplementedError();
+ if (!(other instanceof NetPath))
+ {
+ return false;
+ }
+ return compareTo((NetPath)other) == 0;
}
public int hashCode()
{
- throw new NotYetImplementedError();
+ int hash = 0;
+ for (int i = 0; i < path.length(); i++)
+ {
+ hash = 97 * hash + Character.toUpperCase(path.charAt(i));
+ }
+ return hash;
}
public String toString()