public int getDistance ( final NetworkNode networkNode ) { int steps = 0 ; NetworkNode tmp = this ; while ( tmp != null ) { final int distance = tmp . isPredecessorOrSelfOf ( networkNode ) ; if ( distance >= 0 ) { return ( steps + distance ) ; } tmp = tmp . getParentNode ( ) ; ++ steps ; } return Integer . MAX_VALUE ; }
Determines the distance to the given network node . The distance is determined as the number of internal network nodes that must be traversed in order to send a packet from one node to the other plus one .