Skip to content

Commit

Permalink
Renamed 'equals' methods to 'matches' to avoid confusion.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin committed Oct 24, 2023
1 parent 048495b commit 8971399
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/main/java/emissary/directory/DirectoryEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -421,14 +421,14 @@ public boolean isBetterThan(final DirectoryEntry that) {
/**
* test if the current dataEntry matches the passed key pattern.
*/
public boolean equals(final String pattern) {
return equals(pattern.toCharArray());
public boolean matches(final String pattern) {
return matches(pattern.toCharArray());
}

/**
* test if the current dataEntry matches the passed key pattern
*/
public boolean equals(final char[] pattern) {
public boolean matches(final char[] pattern) {
return KeyManipulator.gmatch(this.theKey.toCharArray(), pattern);
}

Expand All @@ -437,8 +437,8 @@ public boolean equals(final char[] pattern) {
* test if the current dataEntry matches the passed key pattern specifically ignoring cost in the incoming pattern (if
* any)
*/
public boolean equalsIgnoreCost(final String pattern) {
return equals(KeyManipulator.removeExpense(pattern));
public boolean matchesIgnoreCost(final String pattern) {
return matches(KeyManipulator.removeExpense(pattern));
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/emissary/directory/DirectoryEntryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ void testXmlToObject() throws JDOMException {

@Test
void testEquality() {
assertFalse(this.d.equals(KeyManipulator.addExpense(this.d2.getKey(), this.d2.getExpense())), "Entry equality");
assertFalse(this.d2.equals(KeyManipulator.addExpense(this.d.getKey(), this.d.getExpense())), "Entry equality");
assertTrue(this.d.equalsIgnoreCost(KeyManipulator.addExpense(this.d2.getKey(), this.d2.getExpense())), "Entry equality without cost");
assertTrue(this.d2.equalsIgnoreCost(KeyManipulator.addExpense(this.d.getKey(), this.d.getExpense())), "Entry equality without cost");
assertFalse(this.d.matches(KeyManipulator.addExpense(this.d2.getKey(), this.d2.getExpense())), "Entry equality");
assertFalse(this.d2.matches(KeyManipulator.addExpense(this.d.getKey(), this.d.getExpense())), "Entry equality");
assertTrue(this.d.matchesIgnoreCost(KeyManipulator.addExpense(this.d2.getKey(), this.d2.getExpense())), "Entry equality without cost");
assertTrue(this.d2.matchesIgnoreCost(KeyManipulator.addExpense(this.d.getKey(), this.d.getExpense())), "Entry equality without cost");
}

@Test
Expand Down

0 comments on commit 8971399

Please sign in to comment.