diff --git a/src/helma/framework/core/SkinFile.java b/src/helma/framework/core/SkinFile.java index 7861d617..03e7174e 100644 --- a/src/helma/framework/core/SkinFile.java +++ b/src/helma/framework/core/SkinFile.java @@ -164,6 +164,28 @@ public final class SkinFile implements Updatable { * @return ... */ public String toString() { - return "[SkinFile "+prototype.getName() + "/" + name+"]"; + return new StringBuffer("[SkinFile ").append(prototype.getName()) + .append("/").append(name).append("]").toString(); } + + /** + * Override to produce hash code depending on file name + * + * @return a hash code value for this object. + */ + public int hashCode() { + return toString().hashCode(); + } + + /** + * Override to equal other SkinFile with the same source name + * + * @param obj the object to compare to + * @return true if obj is a SkinFile with the same source name + */ + public boolean equals(Object obj) { + return (obj instanceof SkinFile) && + toString().equals(obj.toString()); + } + } diff --git a/src/helma/scripting/ActionFile.java b/src/helma/scripting/ActionFile.java index f0cd7929..a04de2e3 100644 --- a/src/helma/scripting/ActionFile.java +++ b/src/helma/scripting/ActionFile.java @@ -189,4 +189,25 @@ public class ActionFile implements Updatable { public String toString() { return "ActionFile[" + sourceName + "]"; } + + /** + * Override to produce hash code depending on source name + * + * @return a hash code value for this object. + */ + public int hashCode() { + return sourceName.hashCode(); + } + + /** + * Override to equal other ActionFile with the same source name + * + * @param obj the object to compare to + * @return true if obj is a ActionFile with the same source name + */ + public boolean equals(Object obj) { + return (obj instanceof ActionFile) && + sourceName.equals(((ActionFile) obj).getSourceName()); + } + } diff --git a/src/helma/scripting/FunctionFile.java b/src/helma/scripting/FunctionFile.java index fe22fef7..208d1d7f 100644 --- a/src/helma/scripting/FunctionFile.java +++ b/src/helma/scripting/FunctionFile.java @@ -123,4 +123,24 @@ public class FunctionFile implements Updatable { public String toString() { return sourceName; } + + /** + * Override to produce hash code depending on source name + * + * @return a hash code value for this object. + */ + public int hashCode() { + return sourceName.hashCode(); + } + + /** + * Override to equal other FunctionFiles with the same source name + * + * @param obj the object to compare to + * @return true if obj is a FunctionFile with the same source name + */ + public boolean equals(Object obj) { + return (obj instanceof FunctionFile) && + sourceName.equals(((FunctionFile) obj).getSourceName()); + } } diff --git a/src/helma/scripting/Template.java b/src/helma/scripting/Template.java index f85acc82..c7b16d87 100644 --- a/src/helma/scripting/Template.java +++ b/src/helma/scripting/Template.java @@ -235,4 +235,25 @@ public class Template extends ActionFile { return "Template.Part [" + content + "," + isStatic + "]"; } } + + /** + * Override to produce hash code depending on source name + * + * @return a hash code value for this object. + */ + public int hashCode() { + return sourceName.hashCode(); + } + + /** + * Override to equal other Template with the same source name + * + * @param obj the object to compare to + * @return true if obj is a Template with the same source name + */ + public boolean equals(Object obj) { + return (obj instanceof Template) && + sourceName.equals(((Template) obj).getSourceName()); + } + }