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 <florian.dupuy at rte-france.com>
  • Constructor Details

    • 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 Details

    • 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
    • find

      public Optional<? extends Terminal> find(Stream<? 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