Class EclipseStylesheetGenerator
- java.lang.Object
-
- eu.solven.cleanthat.language.java.eclipse.generator.EclipseStylesheetGenerator
-
- All Implemented Interfaces:
IEclipseStylesheetGenerator
public class EclipseStylesheetGenerator extends Object implements IEclipseStylesheetGenerator
Default implementation forIEclipseStylesheetGenerator
- Author:
- Benoit Lacelle
-
-
Constructor Summary
Constructors Constructor Description EclipseStylesheetGenerator()
-
Method Summary
-
-
-
Method Detail
-
generateSettings
public Map<String,String> generateSettings(OffsetDateTime timeout, Map<Path,String> pathToFile)
This method is useful to generate automatically an Eclipse configuration which match an existing code-base. It is especially useful for people NOT using Eclipse IDE.- Specified by:
generateSettings
in interfaceIEclipseStylesheetGenerator
- Parameters:
pathToFile
- aMap
ofPath
to the content of theFile
.timeout
- the maximum duration of the operation- Returns:
- the Set of options which minimizes the modifications over input contents.
-
searchForOptimalConfiguration
public ScoredOption<Map<String,String>> searchForOptimalConfiguration(OffsetDateTime timeout, Map<Path,String> pathToFile, ScoredOption<Map<String,String>> bestDefaultConfig)
- Parameters:
timeout
- at this point of time, we'll interrupt the processpathToFile
-bestDefaultConfig
-- Returns:
-
optimizeSetOfSettings
protected ScoredOption<Map<String,String>> optimizeSetOfSettings(OffsetDateTime timeout, Map<Path,String> pathToFile, ScoredOption<Map<String,String>> bestSettings, Set<String> settingsToSwitch)
-
logPathsImpactedByConfiguration
protected void logPathsImpactedByConfiguration(Map<Path,String> pathToFile, ScoredOption<Map<String,String>> bestOption)
-
findBestDefaultSetting
protected ScoredOption<Map<String,String>> findBestDefaultSetting(OffsetDateTime max, Map<Path,String> pathToFile)
- Parameters:
max
-pathToFile
-- Returns:
- the best configuration amongst a small set of standard configurations
-
logBestDefaultConfig
public void logBestDefaultConfig(Map<String,Map<String,String>> keyToConfig, ScoredOption<Map<String,String>> bestDefaultConfig)
-
pickOptimalOption
public ScoredOption<Map<String,String>> pickOptimalOption(Collection<String> contents, ScoredOption<Map<String,String>> initialOptions, String parameterToSwitch)
- Parameters:
contents
-initialOptions
-parameterToSwitch
-- Returns:
- the best option, excluding the current setting.
-
computeScore
protected ScoredOption<Map<String,String>> computeScore(Collection<String> contents, Map<String,String> tweakedConfiguration)
-
loadFilesContent
public Map<Path,String> loadFilesContent(Path rootForFiles, Pattern fileMatcher) throws IOException
- Specified by:
loadFilesContent
in interfaceIEclipseStylesheetGenerator
- Throws:
IOException
-
getCodeDiffHelper
public CodeDiffHelper getCodeDiffHelper()
-
-