Package com.powsybl.iidm.network.util
Class TerminalFinder
- java.lang.Object
-
- com.powsybl.iidm.network.util.TerminalFinder
-
public final class TerminalFinder extends Object
A class which allows to find the best terminal, according to given comparator or list of predicate, among several terminals.- Author:
- Florian Dupuy
-
-
Constructor Summary
Constructors Constructor Description TerminalFinder(Comparator<Terminal> comparator)
TerminalFinder(List<Predicate<Terminal>> predicates)
Constructs a TerminalFinder based on the given list of predicates, which defines a comparator based on the following rules: a terminal t1 is better than a terminal t2 if the first predicate in the list on which t1 is satisfied is before the first predicate in the list on which t2 is satisfied.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<? extends Terminal>
find(Iterable<? extends Terminal> terminals)
Optional<? extends Terminal>
find(Stream<? extends Terminal> terminals)
static TerminalFinder
getDefault()
-
-
-
Constructor Detail
-
TerminalFinder
public TerminalFinder(Comparator<Terminal> comparator)
-
TerminalFinder
public TerminalFinder(List<Predicate<Terminal>> predicates)
Constructs a TerminalFinder based on the given list of predicates, which defines a comparator based on the following rules: a terminal t1 is better than a terminal t2 if the first predicate in the list on which t1 is satisfied is before the first predicate in the list on which t2 is satisfied.- Parameters:
predicates
- the list of predicates
-
-
Method Detail
-
getDefault
public static TerminalFinder getDefault()
-
find
public Optional<? extends Terminal> find(Iterable<? extends Terminal> terminals)
- Parameters:
terminals
- the terminals among which a terminal has to be chosen- Returns:
- a terminal among the best ones based on the comparator field
-
-