org.lastbamboo.common.ice
Class IceCheckListImpl

java.lang.Object
  extended by org.lastbamboo.common.ice.IceCheckListImpl
All Implemented Interfaces:
IceCheckList

public class IceCheckListImpl
extends Object
implements IceCheckList

Class containing data and state for an ICE check list.

See: http://tools.ietf.org/html/draft-ietf-mmusic-ice-17#section-5.7


Constructor Summary
IceCheckListImpl(IceCandidatePairFactory candidatePairFactory, Collection<IceCandidate> localCandidates)
          Creates a new check list, starting with only local candidates.
 
Method Summary
 void addPair(IceCandidatePair pair)
          Adds the specified ICE candidate pair to the check list.
 void addTriggeredPair(IceCandidatePair pair)
          Adds a pair to the triggered check queue.
 void check()
           
 void close()
          Close all candidates pair connections.
 void executeOnPairs(org.littleshoot.util.Closure<IceCandidatePair> closure)
          Executes the specified Closure on candidate pairs in the check list.
 void formCheckList(Collection<IceCandidate> remoteCandidates)
          Forms the check list.
 IceCheckListState getState()
          Accessor for the state of the check list.
 boolean hasHigherPriorityPendingPair(IceCandidatePair pair)
          Checks whether or not there are existing pairs on either the triggered check list or the normal check list.
 boolean isActive()
          Returns whether or not this check list is considered "active" and should count towards the value of N in timer computation from section 5.8.
 boolean matchesAll(org.littleshoot.util.Predicate<IceCandidatePair> pred)
          Returns whether all the pairs in the check list fit the given predicate.
 boolean matchesAny(org.littleshoot.util.Predicate<IceCandidatePair> pred)
          Returns whether or not any pairs match the specified criteria.
 void recomputePairPriorities(boolean controlling)
          Recomputes the priorities of pairs in checklists.
 IceCandidatePair removeTopTriggeredPair()
          Removes the top triggered pair.
 void removeWaitingAndFrozenPairs(IceCandidatePair nominatedPair)
          Notifies the media stream that there's been a nominated pair.
 IceCandidatePair selectAnyPair(org.littleshoot.util.Predicate<IceCandidatePair> pred)
          Selects the first pair matching the predicate from any check list.
 IceCandidatePair selectPair(org.littleshoot.util.Predicate<IceCandidatePair> pred)
          Selects the first pair matching the predicate from the normal check list.
 void setState(IceCheckListState state)
          Sets the state of the check list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IceCheckListImpl

public IceCheckListImpl(IceCandidatePairFactory candidatePairFactory,
                        Collection<IceCandidate> localCandidates)
Creates a new check list, starting with only local candidates.

Parameters:
candidatePairFactory - Factory for creating candidate pairs.
localCandidates - The local candidates to use in the check list.
Method Detail

removeTopTriggeredPair

public IceCandidatePair removeTopTriggeredPair()
Description copied from interface: IceCheckList
Removes the top triggered pair. Triggered pairs are maintained in a FIFO queue.

Specified by:
removeTopTriggeredPair in interface IceCheckList
Returns:
The top triggered pair, or null if there is no such pair.

setState

public void setState(IceCheckListState state)
Description copied from interface: IceCheckList
Sets the state of the check list.

Specified by:
setState in interface IceCheckList
Parameters:
state - The state of the check list.

getState

public IceCheckListState getState()
Description copied from interface: IceCheckList
Accessor for the state of the check list.

Specified by:
getState in interface IceCheckList
Returns:
The state of the check list.

check

public void check()
Specified by:
check in interface IceCheckList

isActive

public boolean isActive()
Description copied from interface: IceCheckList
Returns whether or not this check list is considered "active" and should count towards the value of N in timer computation from section 5.8.

Specified by:
isActive in interface IceCheckList
Returns:
true if the check list is active, otherwise false.

addTriggeredPair

public void addTriggeredPair(IceCandidatePair pair)
Description copied from interface: IceCheckList
Adds a pair to the triggered check queue.

Specified by:
addTriggeredPair in interface IceCheckList
Parameters:
pair - The pair to add.

addPair

public void addPair(IceCandidatePair pair)
Description copied from interface: IceCheckList
Adds the specified ICE candidate pair to the check list.

Specified by:
addPair in interface IceCheckList
Parameters:
pair - The pair to add.

recomputePairPriorities

public void recomputePairPriorities(boolean controlling)
Description copied from interface: IceCheckList
Recomputes the priorities of pairs in checklists. This can happen, for example, if our role has changed from controlling to controlled or vice versa.

Specified by:
recomputePairPriorities in interface IceCheckList
Parameters:
controlling - The current controlling status of the agent.

formCheckList

public void formCheckList(Collection<IceCandidate> remoteCandidates)
Description copied from interface: IceCheckList
Forms the check list. The check list is not created upon construction because we can receive incoming checks before we've received the answer, requiring adding triggered pairs to the list before we can create a proper check list.

Specified by:
formCheckList in interface IceCheckList
Parameters:
remoteCandidates - The remote candidates to use in forming a check list.

hasHigherPriorityPendingPair

public boolean hasHigherPriorityPendingPair(IceCandidatePair pair)
Description copied from interface: IceCheckList
Checks whether or not there are existing pairs on either the triggered check list or the normal check list. For the normal check list, the pair must be in the FROZEN, WAITING, or IN PROGRESS states.

Specified by:
hasHigherPriorityPendingPair in interface IceCheckList
Parameters:
pair - The pair to check.
Returns:
true if there's a higher priority pair that could still complete its check, otherwise false.

removeWaitingAndFrozenPairs

public void removeWaitingAndFrozenPairs(IceCandidatePair nominatedPair)
Description copied from interface: IceCheckList
Notifies the media stream that there's been a nominated pair. The media stream follows the process in section 8.1.2, removing all Waiting and Frozen pairs in the check list and the triggered check queue and ceasing retransmissions for pairs that are In-Progress if their priorities are lower than the nominated pair.

Specified by:
removeWaitingAndFrozenPairs in interface IceCheckList
Parameters:
nominatedPair - The nominated pair.

executeOnPairs

public void executeOnPairs(org.littleshoot.util.Closure<IceCandidatePair> closure)
Description copied from interface: IceCheckList
Executes the specified Closure on candidate pairs in the check list.

Specified by:
executeOnPairs in interface IceCheckList
Parameters:
closure - The Closure to execute.

selectPair

public IceCandidatePair selectPair(org.littleshoot.util.Predicate<IceCandidatePair> pred)
Description copied from interface: IceCheckList
Selects the first pair matching the predicate from the normal check list.

Specified by:
selectPair in interface IceCheckList
Parameters:
pred - The Predicate to check with.
Returns:
The first matching pair, or null if no such pair exists.

selectAnyPair

public IceCandidatePair selectAnyPair(org.littleshoot.util.Predicate<IceCandidatePair> pred)
Description copied from interface: IceCheckList
Selects the first pair matching the predicate from any check list.

Specified by:
selectAnyPair in interface IceCheckList
Parameters:
pred - The Predicate to check with.
Returns:
The first matching pair from any check list, including the triggered check queue, or null if no such pair exists.

matchesAny

public boolean matchesAny(org.littleshoot.util.Predicate<IceCandidatePair> pred)
Description copied from interface: IceCheckList
Returns whether or not any pairs match the specified criteria.

Specified by:
matchesAny in interface IceCheckList
Parameters:
pred - The Predicate to match against.
Returns:
true if any pairs match the specified criteria, otherwise false.

matchesAll

public boolean matchesAll(org.littleshoot.util.Predicate<IceCandidatePair> pred)
Description copied from interface: IceCheckList
Returns whether all the pairs in the check list fit the given predicate.

Specified by:
matchesAll in interface IceCheckList
Parameters:
pred - The Predicate to match against.
Returns:
true if all pairs match the specified criteria, otherwise false.

close

public void close()
Description copied from interface: IceCheckList
Close all candidates pair connections.

Specified by:
close in interface IceCheckList


Copyright © 2013 LittleShoot. All Rights Reserved.