-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #281 from SimDing/readd-clustering
Concerning issue #116. This adds the clustering that was removed in #89 again, not including any user interfaces. The clustering is implemented in the de.jplag.clustering package. It includes two clustering algorithms (spectral and agglomerative), preprocessing, decoupling logic, clustering options and a factory class which can be used to run the clustering in just two statements.
- Loading branch information
Showing
44 changed files
with
3,569 additions
and
48 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package de.jplag; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import net.sourceforge.argparse4j.inf.ArgumentContainer; | ||
import net.sourceforge.argparse4j.inf.ArgumentGroup; | ||
import net.sourceforge.argparse4j.inf.ArgumentParser; | ||
import net.sourceforge.argparse4j.inf.MutuallyExclusiveGroup; | ||
|
||
/** | ||
* Can be used to automatically create and reuse {@link ArgumentGroup}s and {@link MutuallyExclusiveGroup}s through | ||
* their names only. This is useful when an {@link ArgumentParser} is not configured in an imperative fashion. | ||
*/ | ||
public class CliGroupHelper { | ||
|
||
private final ArgumentParser parser; | ||
private Map<String, MutuallyExclusiveGroup> mutuallyExclusiveGroups = new HashMap<>(); | ||
private Map<String, ArgumentGroup> argumentGroups = new HashMap<>(); | ||
|
||
public CliGroupHelper(ArgumentParser parser) { | ||
this.parser = parser; | ||
} | ||
|
||
public ArgumentContainer getMutuallyExclusiveGroup(String name) { | ||
return mutuallyExclusiveGroups.computeIfAbsent(name, parser::addMutuallyExclusiveGroup); | ||
} | ||
|
||
public ArgumentContainer getArgumentGroup(String name) { | ||
return argumentGroups.computeIfAbsent(name, parser::addArgumentGroup); | ||
} | ||
|
||
} |
This file contains 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
This file contains 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
Oops, something went wrong.