	public synchronized RoutingEntry getBestEntry(HRMID pDestination, int pDesiredMaxDelay, int pDesiredMinDataRate)
	{
		RoutingEntry tResult = null;
		RoutingEntry tBestResultHopCount = null;
		RoutingEntry tBestResultQoS = null;
		boolean DEBUG = HRMConfig.DebugOutput.GUI_SHOW_ROUTING;
		Logging.log(this, "### Searching for best routing table entry towards: " + pDestination +", desired max. delay=" + pDesiredMaxDelay + ", desired min. data rate=" + pDesiredMinDataRate);
		if(size() > 0){
			for(RoutingEntry tEntry : this){
				if(pDestination.isCluster(tEntry.getDest())){
					if(tBestResultHopCount != null){
						if( 
						  (tBestResultHopCount.getHopCount() > tEntry.getHopCount()) || 
						  (
							  (tBestResultHopCount.getHopCount() == tEntry.getHopCount()) && 
							  ( 
						          (tBestResultHopCount.getMaxAvailableDataRate() < tEntry.getMaxAvailableDataRate()) ||
								  ( 
								      (tBestResultHopCount.getMaxAvailableDataRate() == tEntry.getMaxAvailableDataRate()) && (tBestResultHopCount.getMinDelay() > tEntry.getMinDelay()) 
								  )
							  ) 
						  ) 
						  ){
							if (DEBUG){
								Logging.log(this, "      ..found better (BE) entry: " + tEntry);
							}
							tBestResultHopCount = tEntry.clone();
						}else{
							if (DEBUG){
								Logging.log(this, "      ..found uninteresting (BE) entry: " + tEntry);
							}
						}
					}else{
						if (DEBUG){
							Logging.log(this, "      ..found first matching (BE) entry: " + tEntry);
						}
						tBestResultHopCount = tEntry.clone();
					}
					if (((pDesiredMaxDelay > 0) && (pDesiredMaxDelay >= tEntry.getMinDelay()) || (pDesiredMaxDelay <= 0)) && 
					   ((pDesiredMinDataRate > 0) && (pDesiredMinDataRate <= tEntry.getMaxAvailableDataRate())) || (pDesiredMinDataRate <= 0)){
						if(tBestResultQoS != null){						
							if(
							  ( (pDesiredMinDataRate > 0) &&
							  ( (tBestResultQoS.getMaxAvailableDataRate() < tEntry.getMaxAvailableDataRate()) ||
							  ( (tBestResultQoS.getMaxAvailableDataRate() == tEntry.getMaxAvailableDataRate()) && (pDesiredMaxDelay <= 0) && (tBestResultQoS.getHopCount() > tEntry.getHopCount()) ) ) ) ||
							  ( (pDesiredMaxDelay > 0) && ( (pDesiredMinDataRate <= 0) || (tBestResultQoS.getMaxAvailableDataRate() == tEntry.getMaxAvailableDataRate()) ) &&  	  
							  ( (tBestResultQoS.getMinDelay() > tEntry.getMinDelay()) ||
							  ( (tBestResultQoS.getMinDelay() == tEntry.getMinDelay()) && (tBestResultQoS.getHopCount() > tEntry.getHopCount()) ) ) )
							  ){
								if (DEBUG){
									Logging.log(this, "      ..found better (QoS) entry: " + tEntry);
								}
								tBestResultQoS = tEntry.clone();
							}else{
								if (DEBUG){
									Logging.log(this, "      ..found uninteresting (QoS) entry: " + tEntry);
								}
							}
						}else{
							if (DEBUG){
								Logging.log(this, "      ..found first matching (QoS) entry: " + tEntry);
							}
							tBestResultQoS = tEntry.clone();
						}
					}
				}else{
					if (DEBUG){
						Logging.log(this, "      ..ignoring entry: " + tEntry);
					}
				}
			}
			tResult = tBestResultHopCount;
			if((pDesiredMinDataRate > 0) || (pDesiredMaxDelay > 0)) {
				if(tBestResultQoS != null){
					tResult = tBestResultQoS;
				}
			}			
		}else{
			if (DEBUG){
				Logging.log(this, "      ..found empty routing table");
			}
		}
		Logging.log(this, "### BEST ROUTE is: " + tResult);
		return tResult;
	}

	public synchronized RoutingEntry getBestEntry(HRMID pDestination, int pDesiredMaxDelay, int pDesiredMinDataRate)
	{
		RoutingEntry tResult = null;
		RoutingEntry tBestResultHopCount = null;
		RoutingEntry tBestResultQoS = null;
		boolean DEBUG = HRMConfig.DebugOutput.GUI_SHOW_ROUTING;
		if (DEBUG){
			Logging.log(this, "### Searching for best routing table entry towards: " + pDestination +", desired max. delay=" + pDesiredMaxDelay + ", desired min. data rate=" + pDesiredMinDataRate);
		}
		if(size() > 0){
			for(RoutingEntry tEntry : this){
				if(pDestination.isCluster(tEntry.getDest())){
					if(tBestResultHopCount != null){
						if( 
						  (tBestResultHopCount.getHopCount() > tEntry.getHopCount()) || 
						  (
							  (tBestResultHopCount.getHopCount() == tEntry.getHopCount()) && 
							  ( 
						          (tBestResultHopCount.getMaxAvailableDataRate() < tEntry.getMaxAvailableDataRate()) ||
								  ( 
								      (tBestResultHopCount.getMaxAvailableDataRate() == tEntry.getMaxAvailableDataRate()) && (tBestResultHopCount.getMinDelay() > tEntry.getMinDelay()) 
								  )
							  ) 
						  ) 
						  ){
							if (DEBUG){
								Logging.log(this, "      ..found better (BE) entry: " + tEntry);
							}
							tBestResultHopCount = tEntry.clone();
						}else{
							if (DEBUG){
								Logging.log(this, "      ..found uninteresting (BE) entry: " + tEntry);
							}
						}
					}else{
						if (DEBUG){
							Logging.log(this, "      ..found first matching (BE) entry: " + tEntry);
						}
						tBestResultHopCount = tEntry.clone();
					}
					if (((pDesiredMaxDelay > 0) && (pDesiredMaxDelay >= tEntry.getMinDelay()) || (pDesiredMaxDelay <= 0)) && 
					   ((pDesiredMinDataRate > 0) && (pDesiredMinDataRate <= tEntry.getMaxAvailableDataRate())) || (pDesiredMinDataRate <= 0)){
						if(tBestResultQoS != null){						
							if(
							  ( (pDesiredMinDataRate > 0) &&
							  ( (tBestResultQoS.getMaxAvailableDataRate() < tEntry.getMaxAvailableDataRate()) ||
							  ( (tBestResultQoS.getMaxAvailableDataRate() == tEntry.getMaxAvailableDataRate()) && (pDesiredMaxDelay <= 0) && (tBestResultQoS.getHopCount() > tEntry.getHopCount()) ) ) ) ||
							  ( (pDesiredMaxDelay > 0) && ( (pDesiredMinDataRate <= 0) || (tBestResultQoS.getMaxAvailableDataRate() == tEntry.getMaxAvailableDataRate()) ) &&  	  
							  ( (tBestResultQoS.getMinDelay() > tEntry.getMinDelay()) ||
							  ( (tBestResultQoS.getMinDelay() == tEntry.getMinDelay()) && (tBestResultQoS.getHopCount() > tEntry.getHopCount()) ) ) )
							  ){
								if (DEBUG){
									Logging.log(this, "      ..found better (QoS) entry: " + tEntry);
								}
								tBestResultQoS = tEntry.clone();
							}else{
								if (DEBUG){
									Logging.log(this, "      ..found uninteresting (QoS) entry: " + tEntry);
								}
							}
						}else{
							if (DEBUG){
								Logging.log(this, "      ..found first matching (QoS) entry: " + tEntry);
							}
							tBestResultQoS = tEntry.clone();
						}
					}
				}else{
					if (DEBUG){
						Logging.log(this, "      ..ignoring entry: " + tEntry);
					}
				}
			}
			tResult = tBestResultHopCount;
			if((pDesiredMinDataRate > 0) || (pDesiredMaxDelay > 0)) {
				if(tBestResultQoS != null){
					tResult = tBestResultQoS;
				}
			}			
		}else{
			if (DEBUG){
				Logging.log(this, "      ..found empty routing table");
			}
		}
		if (DEBUG){
			Logging.log(this, "### BEST ROUTE is: " + tResult);
		}
		return tResult;
	}
