From 011424ad46dc1fbcf52d5fe5e52453711f24d2bb Mon Sep 17 00:00:00 2001 From: David McKnight Date: Wed, 9 Aug 2006 16:32:29 +0000 Subject: [PATCH] equals for RemoteFile - fix for 148981 --- .../files/core/subsystems/RemoteFile.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFile.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFile.java index f8845af854e..8a7755605fc 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFile.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFile.java @@ -1098,10 +1098,10 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable { if (rule instanceof RemoteFile) { - String otherPath = ((RemoteFile) rule).getAbsolutePath(); + String otherPath = ((RemoteFile)rule).getAbsolutePath(); String path = this.getAbsolutePath(); - String otherHost = ((RemoteFile) rule).getHostName(); - return getHostName().equals(otherHost) && path.startsWith(otherPath) || otherPath.startsWith(path); + String otherHost = ((RemoteFile)rule).getHostName(); + return getHostName().equals(otherHost) && path.startsWith(otherPath) || otherPath.startsWith(path); } else if (rule instanceof RemoteFileSchedulingRule) { @@ -1116,6 +1116,24 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable } } + public boolean equals(Object otherObj) + { + if (otherObj instanceof RemoteFile) + { + RemoteFile other = (RemoteFile)otherObj; + if (this == other) return true; + + String otherPath = other.getAbsolutePath(); + String path = this.getAbsolutePath(); + String otherHost = other.getHostName(); + return getHostName().equals(otherHost) && path.equals(otherPath) || otherPath.equals(path); + } + else + { + return false; + } + } + public String getHostName() { return getSystemConnection().getHostName();