Some helpers for adding an ICE nomination strategy config option. (#197)
* Add fromString method to NominationStrategy. * Add getters for NominationStrategy. This allows Kotlin to model Agent's nominationStrategy as a property.
This commit is contained in:
parent
35e149848e
commit
982e78212b
@ -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
|
* Specifies the {@link NominationStrategy} that we should use in order to
|
||||||
* decide if and when we should nominate valid pairs.
|
* decide if and when we should nominate valid pairs.
|
||||||
|
|||||||
@ -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
|
* The {@link NominationStrategy} that this nominator should use when
|
||||||
* deciding whether or not a valid {@link CandidatePair} is suitable for
|
* deciding whether or not a valid {@link CandidatePair} is suitable for
|
||||||
|
|||||||
@ -44,8 +44,11 @@ public enum NominationStrategy
|
|||||||
NOMINATE_FIRST_VALID("NominateFirstValid"),
|
NOMINATE_FIRST_VALID("NominateFirstValid"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The strategy consists in nominating the highest priority valid pair once
|
* The strategy consists in nominating the highest priority valid pair.
|
||||||
* all checks in a list have completed.
|
* 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"),
|
NOMINATE_HIGHEST_PRIO("NominateHighestPriority"),
|
||||||
|
|
||||||
@ -90,4 +93,19 @@ public enum NominationStrategy
|
|||||||
{
|
{
|
||||||
return strategyName;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user