Search in sources :

Example 1 with SearchPredicatesPlugin

use of jack.rm.plugins.types.SearchPredicatesPlugin in project rom-manager by Jakz.

the class MyGameSetFeatures method pluginStateChanged.

public void pluginStateChanged() {
    Settings settings = Main.setManager.settings(set);
    if (settings.getSearchPlugin() != null) {
        List<SearchPredicate<Game>> predicates = new ArrayList<>();
        SearchPlugin plugin = settings.plugins.getEnabledPlugin(PluginRealType.SEARCH);
        SearchParser<Game> parser = plugin.getSearcher();
        Set<SearchPredicatesPlugin> predicatePlugins = settings.plugins.getEnabledPlugins(PluginRealType.SEARCH_PREDICATES);
        predicatePlugins.stream().flatMap(p -> p.getPredicates().stream()).forEach(predicates::add);
        searcher = new Searcher<>(parser, predicates);
    } else
        searcher = new DummySearcher<>();
    if (settings.getRenamer() != null)
        renamer = settings.getRenamer();
    else
        renamer = GameRenamer.DUMMY;
    if (settings.getFolderOrganizer() != null)
        mover = settings.getFolderOrganizer();
    else
        mover = GameMover.DUMMY;
    scanner = new Scanner(set);
}
Also used : DummySearcher(com.pixbits.lib.searcher.DummySearcher) Arrays(java.util.Arrays) Scanner(jack.rm.files.Scanner) SearchParser(com.pixbits.lib.searcher.SearchParser) PluginRealType(jack.rm.plugins.PluginRealType) SearchPlugin(jack.rm.plugins.types.SearchPlugin) Game(com.github.jakz.romlib.data.game.Game) Set(java.util.Set) SearchPredicatesPlugin(jack.rm.plugins.types.SearchPredicatesPlugin) GameRenamer(com.github.jakz.romlib.data.set.organizers.GameRenamer) Organizer(jack.rm.files.Organizer) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) GameSet(com.github.jakz.romlib.data.set.GameSet) List(java.util.List) SearchPredicate(com.pixbits.lib.searcher.SearchPredicate) Paths(java.nio.file.Paths) GameSetFeatures(com.github.jakz.romlib.data.set.GameSetFeatures) Path(java.nio.file.Path) Main(jack.rm.Main) GameMover(com.github.jakz.romlib.data.set.organizers.GameMover) Searcher(com.pixbits.lib.searcher.Searcher) Feature(com.github.jakz.romlib.data.set.Feature) Scanner(jack.rm.files.Scanner) ArrayList(java.util.ArrayList) SearchPredicate(com.pixbits.lib.searcher.SearchPredicate) SearchPlugin(jack.rm.plugins.types.SearchPlugin) Game(com.github.jakz.romlib.data.game.Game) DummySearcher(com.pixbits.lib.searcher.DummySearcher) SearchPredicatesPlugin(jack.rm.plugins.types.SearchPredicatesPlugin)

Aggregations

Game (com.github.jakz.romlib.data.game.Game)1 Feature (com.github.jakz.romlib.data.set.Feature)1 GameSet (com.github.jakz.romlib.data.set.GameSet)1 GameSetFeatures (com.github.jakz.romlib.data.set.GameSetFeatures)1 GameMover (com.github.jakz.romlib.data.set.organizers.GameMover)1 GameRenamer (com.github.jakz.romlib.data.set.organizers.GameRenamer)1 DummySearcher (com.pixbits.lib.searcher.DummySearcher)1 SearchParser (com.pixbits.lib.searcher.SearchParser)1 SearchPredicate (com.pixbits.lib.searcher.SearchPredicate)1 Searcher (com.pixbits.lib.searcher.Searcher)1 Main (jack.rm.Main)1 Organizer (jack.rm.files.Organizer)1 Scanner (jack.rm.files.Scanner)1 PluginRealType (jack.rm.plugins.PluginRealType)1 SearchPlugin (jack.rm.plugins.types.SearchPlugin)1 SearchPredicatesPlugin (jack.rm.plugins.types.SearchPredicatesPlugin)1 Path (java.nio.file.Path)1 Paths (java.nio.file.Paths)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1