Skip to content

Commit

Permalink
Renamed methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-rapp committed Aug 7, 2017
1 parent 8580cb9 commit eea2c3e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions src/main/java/de/mrapp/apriori/Sorting.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ protected SortingType self() {
* sorted.
*/
private AbstractSorting() {
order(Order.DESCENDING);
tieBreak(null);
withOrder(Order.DESCENDING);
withTieBreaking(null);
}

/**
Expand All @@ -78,7 +78,7 @@ private AbstractSorting() {
* SortingType. The sorting may not be null
*/
@NotNull
public SortingType order(@NotNull final Order order) {
public SortingType withOrder(@NotNull final Order order) {
ensureNotNull(order, "The order may not be null");
this.order = order;
return self();
Expand All @@ -94,7 +94,7 @@ public SortingType order(@NotNull final Order order) {
* SortingType. The sorting may not be null
*/
@NotNull
public SortingType tieBreak(@Nullable final Comparator<T> comparator) {
public SortingType withTieBreaking(@Nullable final Comparator<T> comparator) {
this.tieBreaker = comparator;
return self();
}
Expand Down Expand Up @@ -134,7 +134,7 @@ public static class AssociationRuleSorting extends
* Creates a new sorting, which applies to association rules.
*/
private AssociationRuleSorting() {
operator(new Confidence());
byOperator(new Confidence());
}

/**
Expand All @@ -146,7 +146,7 @@ private AssociationRuleSorting() {
* AssociationRuleSorting}. The sorting may not be null
*/
@NotNull
public AssociationRuleSorting operator(@Nullable final Operator operator) {
public AssociationRuleSorting byOperator(@Nullable final Operator operator) {
this.operator = operator;
return self();
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/de/mrapp/apriori/RuleSetTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public final void testSort() {
ruleSet.add(associationRule2);
assertEquals(associationRule1, ruleSet.first());
assertEquals(associationRule2, ruleSet.last());
Sorting<AssociationRule> sorting = Sorting.forAssociationRules().order(Order.ASCENDING);
Sorting<AssociationRule> sorting = Sorting.forAssociationRules().withOrder(Order.ASCENDING);
RuleSet<NamedItem> sortedRuleSet = ruleSet.sort(sorting);
assertEquals(associationRule2, sortedRuleSet.first());
assertEquals(associationRule1, sortedRuleSet.last());
Expand Down
14 changes: 7 additions & 7 deletions src/test/java/de/mrapp/apriori/SortingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void testAscendingSortingForItemSets() {
itemSet1.setSupport(0.5);
ItemSet<NamedItem> itemSet2 = new ItemSet<>();
itemSet2.setSupport(0.5);
Sorting<ItemSet> sorting = Sorting.forItemSets().order(Sorting.Order.ASCENDING);
Sorting<ItemSet> sorting = Sorting.forItemSets().withOrder(Sorting.Order.ASCENDING);
assertEquals(0, sorting.compare(itemSet1, itemSet2));
itemSet1.setSupport(0.6);
assertEquals(1, sorting.compare(itemSet1, itemSet2));
Expand All @@ -52,7 +52,7 @@ public void testAscendingSortingForItemSets() {
*/
@Test(expected = IllegalArgumentException.class)
public void testSortingForItemSetsThrowsExceptionIfOrderIsNull() {
Sorting.forItemSets().order(null);
Sorting.forItemSets().withOrder(null);
}

/**
Expand All @@ -64,7 +64,7 @@ public void testSortingForItemSetsWhenTieBreaking() {
itemSet1.setSupport(0.5);
ItemSet<NamedItem> itemSet2 = new ItemSet<>();
itemSet2.setSupport(0.5);
Sorting<ItemSet> sorting = Sorting.forItemSets().tieBreak((o1, o2) -> 1);
Sorting<ItemSet> sorting = Sorting.forItemSets().withTieBreaking((o1, o2) -> 1);
assertEquals(-1, sorting.compare(itemSet1, itemSet2));
}

Expand Down Expand Up @@ -110,7 +110,7 @@ public void testAscendingSortingForAssociationRules() {
ItemSet<NamedItem> head2 = new ItemSet<>();
head2.add(new NamedItem("d"));
AssociationRule<NamedItem> associationRule2 = new AssociationRule<>(body2, head2, 0.25);
Sorting<AssociationRule> sorting = Sorting.forAssociationRules().order(
Sorting<AssociationRule> sorting = Sorting.forAssociationRules().withOrder(
Sorting.Order.ASCENDING);
assertEquals(0, sorting.compare(associationRule1, associationRule2));
associationRule1 = new AssociationRule<>(body1, head1, 0.5);
Expand All @@ -125,7 +125,7 @@ public void testAscendingSortingForAssociationRules() {
*/
@Test(expected = IllegalArgumentException.class)
public void testSortingForAssociationRulesThrowsExceptionIfOrderIsNull() {
Sorting.forAssociationRules().order(null);
Sorting.forAssociationRules().withOrder(null);
}

/**
Expand All @@ -145,7 +145,7 @@ public void testSortingForAssociationRulesWhenTieBreaking() {
ItemSet<NamedItem> head2 = new ItemSet<>();
head2.add(new NamedItem("d"));
AssociationRule<NamedItem> associationRule2 = new AssociationRule<>(body2, head2, 0.25);
Sorting<AssociationRule> sorting = Sorting.forAssociationRules().tieBreak((o1, o2) -> 1);
Sorting<AssociationRule> sorting = Sorting.forAssociationRules().withTieBreaking((o1, o2) -> 1);
assertEquals(-1, sorting.compare(associationRule1, associationRule2));
}

Expand All @@ -166,7 +166,7 @@ public void testSortingByOperatorForAssociationRules() {
ItemSet<NamedItem> head2 = new ItemSet<>();
head2.add(new NamedItem("d"));
AssociationRule<NamedItem> associationRule2 = new AssociationRule<>(body2, head2, 0.25);
Sorting<AssociationRule> sorting = Sorting.forAssociationRules().operator(new Support());
Sorting<AssociationRule> sorting = Sorting.forAssociationRules().byOperator(new Support());
assertEquals(0, sorting.compare(associationRule1, associationRule2));
associationRule1 = new AssociationRule<>(body1, head1, 0.5);
assertEquals(-1, sorting.compare(associationRule1, associationRule2));
Expand Down

0 comments on commit eea2c3e

Please sign in to comment.