Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix typo: Occurence->Occurrence (important for consistency, see previous changes!) #2249

Merged
merged 5 commits into from
Jul 30, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix
  • Loading branch information
zielint0 committed Jul 23, 2018
commit 96042a7d87e29eefaa0cf7063a306981d23754ee
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public PatternParameterConfigurator setMinOccurrence(int minOccurrence) {
return this;
}

public PatternParameterConfigurator setMaxOccurence(int maxOccurrence) {
public PatternParameterConfigurator setMaxOccurrence(int maxOccurrence) {
if (maxOccurrence == ParameterInfo.UNLIMITED_OCCURRENCES || maxOccurrence > 1 && currentParameter.isMultiple() == false) {
throw new SpoonException("Cannot set maxOccurrences > 1 for single value parameter. Call setMultiple(true) first.");
}
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/spoon/test/template/PatternTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ public void testMatchGreedyMultiValueUnlimited() throws Exception {
@Test
public void testMatchGreedyMultiValueMaxCountLimit() throws Exception {
//contract: it is possible to stop matching after a specific number of times
// This is done with method parameterBuilder.setMaxOccurence(maxCount)
// This is done with method parameterBuilder.setMaxOccurrence(maxCount)

// explanation: greedy matching eats everything until max count = 3
CtType<?> ctClass = ModelUtils.buildClass(MatchMultiple.class);
Expand Down Expand Up @@ -514,7 +514,7 @@ public void testMatchPossesiveMultiValueUnlimited() throws Exception {
}
@Test
public void testMatchPossesiveMultiValueMaxCount4() throws Exception {
//contract: maxCount (#setMaxOccurence) can be used to stop Quantifier.POSSESSIVE for matching too much
//contract: maxCount (#setMaxOccurrence) can be used to stop Quantifier.POSSESSIVE for matching too much
CtType<?> ctClass = ModelUtils.buildClass(MatchMultiple.class);

// note that if we set maxCount = 3, it fails because there is one dangling statement before System.out.println("something")
Expand Down Expand Up @@ -568,7 +568,7 @@ public void testMatchPossesiveMultiValueMinCount() throws Exception {
.configurePatternParameters()
.configurePatternParameters(pb -> {
pb.parameter("statements1").setContainerKind(ContainerKind.LIST).setMatchingStrategy(Quantifier.GREEDY);
pb.parameter("statements2").setContainerKind(ContainerKind.LIST).setMatchingStrategy(Quantifier.POSSESSIVE).setMinOccurrence(countFinal).setMaxOccurence(countFinal);
pb.parameter("statements2").setContainerKind(ContainerKind.LIST).setMatchingStrategy(Quantifier.POSSESSIVE).setMinOccurrence(countFinal).setMaxOccurrence(countFinal);
pb.parameter("printedValue").byFilter((CtLiteral<?> literal) -> "something".equals(literal.getValue()));
})
.build();
Expand Down Expand Up @@ -606,7 +606,7 @@ public void testMatchPossesiveMultiValueMinCount2() throws Exception {
.configurePatternParameters(pb -> {
pb.byTemplateParameter();
pb.parameter("statements1").setContainerKind(ContainerKind.LIST).setMatchingStrategy(Quantifier.GREEDY);
pb.parameter("statements2").setContainerKind(ContainerKind.LIST).setMatchingStrategy(Quantifier.POSSESSIVE).setMinOccurrence(countFinal).setMaxOccurence(countFinal);
pb.parameter("statements2").setContainerKind(ContainerKind.LIST).setMatchingStrategy(Quantifier.POSSESSIVE).setMinOccurrence(countFinal).setMaxOccurrence(countFinal);
pb.parameter("inlinedSysOut").byVariable("something").setMatchingStrategy(Quantifier.POSSESSIVE).setContainerKind(ContainerKind.LIST).setMinOccurrence(2).matchInlinedStatements();
})
.build();
Expand Down Expand Up @@ -647,7 +647,7 @@ public void testMatchGreedyMultiValueMinCount2() throws Exception {
.configurePatternParameters(pb -> {
pb.byTemplateParameter();
pb.parameter("statements1").setContainerKind(ContainerKind.LIST).setMatchingStrategy(Quantifier.RELUCTANT);
pb.parameter("statements2").setContainerKind(ContainerKind.LIST).setMatchingStrategy(Quantifier.GREEDY).setMaxOccurence(count);
pb.parameter("statements2").setContainerKind(ContainerKind.LIST).setMatchingStrategy(Quantifier.GREEDY).setMaxOccurrence(count);
pb.parameter("printedValue").byVariable("something").matchInlinedStatements();
pb.parameter("printedValue").setMatchingStrategy(Quantifier.GREEDY).setContainerKind(ContainerKind.LIST).setMinOccurrence(2);
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static Pattern createPattern(Quantifier matchingStrategy, Integer minCoun
pb.setMinOccurrence(minCount);
}
if (maxCount != null) {
pb.setMaxOccurence(maxCount);
pb.setMaxOccurrence(maxCount);
}
pb.parameter("printedValue").byFilter((CtLiteral<?> literal) -> "something".equals(literal.getValue()));
})
Expand Down