Implements Agent#isOver() in IceProcessingState (like isEstablished()).

This commit is contained in:
Lyubomir Marinov 2016-03-24 16:17:27 -05:00
parent eb0e3d3fb8
commit 945c0ccd65
2 changed files with 19 additions and 3 deletions

View File

@ -681,9 +681,9 @@ public class Agent
*/ */
public boolean isOver() public boolean isOver()
{ {
return state == IceProcessingState.COMPLETED IceProcessingState state = getState();
|| state == IceProcessingState.TERMINATED
|| state == IceProcessingState.FAILED; return (state != null) && state.isOver();
} }
/** /**

View File

@ -35,6 +35,7 @@ package org.ice4j.ice;
* refer to with "Terminated". * refer to with "Terminated".
* *
* @author Emil Ivov * @author Emil Ivov
* @author Lyubomir Marinov
*/ */
public enum IceProcessingState public enum IceProcessingState
{ {
@ -99,6 +100,21 @@ public enum IceProcessingState
return stateName; return stateName;
} }
/**
* Determines whether an {@link Agent} in this state has finished its ICE
* processing.
*
* @return {@code true} if an {@code Agent} in this state has finished its
* ICE processing; otherwise, {@code false}
*/
public boolean isOver()
{
return
COMPLETED.equals(this)
|| FAILED.equals(this)
|| TERMINATED.equals(this);
}
/** /**
* Returns <tt>true</tt> iff the state is one in which a connection * Returns <tt>true</tt> iff the state is one in which a connection
* has been established, that is either <tt>COMPLETED</tt> or * has been established, that is either <tt>COMPLETED</tt> or