mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
GUACAMOLE-102: Remove unnecessary checks for weight value in the compare function.
This commit is contained in:
committed by
Nick Couchman
parent
58637818ca
commit
aa4c134922
@@ -187,21 +187,10 @@ public class RestrictedGuacamoleTunnelService
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(ModeledConnection a, ModeledConnection b) {
|
public int compare(ModeledConnection a, ModeledConnection b) {
|
||||||
|
|
||||||
int weightA, weightB;
|
|
||||||
// Check if weight of a is non-null and retrieve it.
|
|
||||||
if (a.getConnectionWeight().intValue() > 0)
|
|
||||||
weightA = a.getConnectionWeight().intValue();
|
|
||||||
// In all other cases assign 1 for sorting.
|
|
||||||
else
|
|
||||||
weightA = 1;
|
|
||||||
|
|
||||||
// Check if weight of b is null, assign 1 if it is.
|
// Get connection weight for the two systems being compared.
|
||||||
if (b.getConnectionWeight().intValue() > 0)
|
int weightA = a.getConnectionWeight().intValue();
|
||||||
weightB = b.getConnectionWeight().intValue();
|
int weightB = b.getConnectionWeight().intValue();
|
||||||
// In all other cases assign 1 for sorting.
|
|
||||||
else
|
|
||||||
weightB = 1;
|
|
||||||
|
|
||||||
// Get current active connections, add 1 to both to avoid calculations with 0.
|
// Get current active connections, add 1 to both to avoid calculations with 0.
|
||||||
int connsA = getActiveConnections(a).size() + 1;
|
int connsA = getActiveConnections(a).size() + 1;
|
||||||
|
Reference in New Issue
Block a user