Skip to content

Commit

Permalink
Implement equals() for JavaDependency and UseXSLTPackage
Browse files Browse the repository at this point in the history
  • Loading branch information
bertfrees committed Nov 26, 2024
1 parent b58462c commit 534e466
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,34 @@ public JavaDependency(Module module, String className) {
public String getClassName() {
return className;
}

@Override
public String toString() {
return className;
}

@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null)
return false;
if (!(o instanceof JavaDependency))
return false;
JavaDependency that = (JavaDependency)o;
//if (!module.equals(that.module))
// return false;
if (!className.equals(that.className))
return false;
return true;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
//result = prime * result + module.hashCode();
result = prime * result + className.hashCode();
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,29 @@ public String getName() {
public String getVersion() {
return version;
}

@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null)
return false;
if (!(o instanceof UseXSLTPackage))
return false;
UseXSLTPackage that = (UseXSLTPackage)o;
if (!name.equals(that.name))
return false;
if (!version.equals(that.version))
return false;
return true;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + name.hashCode();
result = prime * result + version.hashCode();
return result;
}
}

0 comments on commit 534e466

Please sign in to comment.