Skip to content

Commit

Permalink
Merge branch 'FeKozma:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Livila authored Mar 9, 2024
2 parents f4fe586 + ecfe86e commit 40ca2c6
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions src/main/java/CodeCheck/OneFunction.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,30 @@ protected OneFunction() {
content = new ArrayList<>();
}

public int equals(OneFunction obj) {
private enum Compare {
Default,
Identical,
Similar,
CloseThereby,
}

public Compare equals(OneFunction obj) {
if (obj.content.size() > 2 && obj.name.equals(name) && obj.removeExtraInformationAndGetString().equals(removeExtraInformationAndGetString()))
return 1;
return Compare.Identical;
if (obj.name.equals(name) && obj.content.size() > 4 && content.size() > 4)
return 2;
return Compare.Similar;
if (obj.name.equals(name))
return 3;
return Compare.CloseThereby;

return 10;
return Compare.Default;
}

public Comparison compare(OneFunction other, LLM llm) {
return switch (equals(other)) {
case 1 -> new Comparison(true, "Functions are identical.").setFunctions(this, other);
case 2 -> similar(other, llm);
case 3 -> new Comparison(false, false, "Empty or closetherby.");
default -> new Comparison();
public Comparison compare(OneFunction laterOneFunction, LLM llm) {
return switch (equals(laterOneFunction)) {
case Identical -> new Comparison(true, "Functions are identical.").setFunctions(this, laterOneFunction);
case Similar -> similar(laterOneFunction, llm);
case CloseThereby -> new Comparison(false, false, "Empty or closetherby.");
case Default -> new Comparison();
};
}

Expand Down

0 comments on commit 40ca2c6

Please sign in to comment.