Skip to content

Tuscan square detectors#49

Open
mmk-1 wants to merge 42 commits into
UT-SE-Research:masterfrom
mmk-1:tuscan_square_detectors
Open

Tuscan square detectors#49
mmk-1 wants to merge 42 commits into
UT-SE-Research:masterfrom
mmk-1:tuscan_square_detectors

Conversation

@mmk-1

@mmk-1 mmk-1 commented Aug 17, 2022

Copy link
Copy Markdown

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.

@winglam

winglam commented Aug 20, 2022

Copy link
Copy Markdown
Collaborator

@mmk-1 Can you please resolve the merge conflicts?

@mmk-1

mmk-1 commented Aug 21, 2022

Copy link
Copy Markdown
Author

Hello, I have resolved the conflicts.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the meaning behind the commented out code here?

HashMap<String, List<String>> newClassToMethods = new HashMap<String, List<String>>();
List<String> permClasses = new ArrayList<String>();
int classRound = round;
while ((classOrdering.length - 1) < classRound) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should add some comment to explain the reasoning/intention behind this loop concerning the class round, so we remember later what is the goal.

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")) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe move this above to put next to tuscan (or move tuscan below to be next to this one).

int maxMethodSize = 0;
for (String className : classToMethods.keySet()) {
int nn = classToMethods.get(className).size();
if(maxMethodSize < nn) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space after if

classToMethods.get(className).add(test);
}
int classSize = classToMethods.keySet().size();
// if (classSize == 3 || classSize == 5) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it unnecessary now to consider the 3 and 5 edge cases?

@Test
public void test() throws Exception {
String[] testArray = {
"cn.edu.hfut.dmic.webcollector.util.CharsetDetectorTest.testGuessEncodingByMozilla",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these strings should be indented one more.

Assert.assertEquals(allMethodPairs.size(), visitedMethodPairs.size());
}

public static HashMap<String, List<String>> generateClassToMethods (List<String> tests) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No space after method name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants