diff --git a/src/main/java/org/ice4j/ice/Agent.java b/src/main/java/org/ice4j/ice/Agent.java index 814754d..d1cfb14 100644 --- a/src/main/java/org/ice4j/ice/Agent.java +++ b/src/main/java/org/ice4j/ice/Agent.java @@ -1849,6 +1849,18 @@ public class Agent } } + /** + * Returns the {@link NominationStrategy} that we use in order to + * decide if and when we should nominate valid pairs. + * + * @return the strategy that we are using for nominating + * valid {@link CandidatePair}s. + */ + public NominationStrategy getNominationStrategy() + { + return this.nominator.getStrategy(); + } + /** * Specifies the {@link NominationStrategy} that we should use in order to * decide if and when we should nominate valid pairs. diff --git a/src/main/java/org/ice4j/ice/DefaultNominator.java b/src/main/java/org/ice4j/ice/DefaultNominator.java index 8eae643..321d2d5 100644 --- a/src/main/java/org/ice4j/ice/DefaultNominator.java +++ b/src/main/java/org/ice4j/ice/DefaultNominator.java @@ -182,6 +182,18 @@ public class DefaultNominator } } + /** + * The {@link NominationStrategy} that this nominator is using when + * deciding whether or not a valid {@link CandidatePair} is suitable for + * nomination. + * + * @return the {@link NominationStrategy} we are using. + */ + public NominationStrategy getStrategy() + { + return strategy; + } + /** * The {@link NominationStrategy} that this nominator should use when * deciding whether or not a valid {@link CandidatePair} is suitable for diff --git a/src/main/java/org/ice4j/ice/NominationStrategy.java b/src/main/java/org/ice4j/ice/NominationStrategy.java index 6d4222f..7fa5c0a 100644 --- a/src/main/java/org/ice4j/ice/NominationStrategy.java +++ b/src/main/java/org/ice4j/ice/NominationStrategy.java @@ -44,8 +44,11 @@ public enum NominationStrategy NOMINATE_FIRST_VALID("NominateFirstValid"), /** - * The strategy consists in nominating the highest priority valid pair once - * all checks in a list have completed. + * The strategy consists in nominating the highest priority valid pair. + * Once a pair is validated, if no higher-priority pairs remain outstanding, + * it is nominated; otherwise, a timer is armed, and if higher-priority + * pairs are still outstanding after the timeout, the highest-priority validated + * pair is nominated. */ NOMINATE_HIGHEST_PRIO("NominateHighestPriority"), @@ -90,4 +93,19 @@ public enum NominationStrategy { return strategyName; } + + /** + * @return the {@link NominationStrategy} with name equal to the given + * string, or {@code null} if there is no such strategy. + * @param string the name of the strategy. + */ + public static NominationStrategy fromString(String string) + { + for (NominationStrategy strategy : NominationStrategy.values()) + { + if (strategy.strategyName.equals(string)) + return strategy; + } + return null; + } }