Tuscan square detectors#49
Open
mmk-1 wants to merge 42 commits into
Open
Conversation
tuscan and alphabetical tuscan detector factory fixed tuscan for 3 and 5 fixed tuscan for 3 and 5 fixed tuscan orders for 3 & 5
added 2 commits
August 17, 2022 18:50
Collaborator
|
@mmk-1 Can you please resolve the merge conflicts? |
Author
|
Hello, I have resolved the conflicts. |
august782
reviewed
Sep 7, 2022
| int n = classes.size(); // n is number of classes | ||
| int[][] classOrdering = Tuscan.generateTuscanPermutations(n); | ||
| for (String className : classes) { | ||
| // This condition may be needed for the tests |
Collaborator
There was a problem hiding this comment.
What is the meaning behind the commented out code here?
august782
reviewed
Sep 7, 2022
| HashMap<String, List<String>> newClassToMethods = new HashMap<String, List<String>>(); | ||
| List<String> permClasses = new ArrayList<String>(); | ||
| int classRound = round; | ||
| while ((classOrdering.length - 1) < classRound) { |
Collaborator
There was a problem hiding this comment.
Should add some comment to explain the reasoning/intention behind this loop concerning the class round, so we remember later what is the goal.
august782
reviewed
Sep 7, 2022
| return new TuscanOnlyClassDetector(runner, baseDir, rounds, detectorType(), tests); | ||
| } else if (detectorType().startsWith("alphabetical")) { | ||
| return new AlphabeticalDetector(runner, baseDir, rounds, detectorType(), tests); | ||
| } else if (detectorType().equals("tuscan-intra-class")) { |
Collaborator
There was a problem hiding this comment.
Maybe move this above to put next to tuscan (or move tuscan below to be next to this one).
august782
reviewed
Sep 7, 2022
| int maxMethodSize = 0; | ||
| for (String className : classToMethods.keySet()) { | ||
| int nn = classToMethods.get(className).size(); | ||
| if(maxMethodSize < nn) { |
august782
reviewed
Sep 7, 2022
| classToMethods.get(className).add(test); | ||
| } | ||
| int classSize = classToMethods.keySet().size(); | ||
| // if (classSize == 3 || classSize == 5) { |
Collaborator
There was a problem hiding this comment.
Is it unnecessary now to consider the 3 and 5 edge cases?
august782
reviewed
Sep 7, 2022
| @Test | ||
| public void test() throws Exception { | ||
| String[] testArray = { | ||
| "cn.edu.hfut.dmic.webcollector.util.CharsetDetectorTest.testGuessEncodingByMozilla", |
Collaborator
There was a problem hiding this comment.
I think these strings should be indented one more.
august782
reviewed
Sep 7, 2022
| Assert.assertEquals(allMethodPairs.size(), visitedMethodPairs.size()); | ||
| } | ||
|
|
||
| public static HashMap<String, List<String>> generateClassToMethods (List<String> tests) { |
Collaborator
There was a problem hiding this comment.
No space after method name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello, this branch includes the additional tuscan-intra-class & tuscan-inter-class detection types plus the tests for tuscan squares (using junit theory), tuscan-only-class, tuscan-intra-class & tuscan-inter-class.