Skip to content

Commit

Permalink
feat: allowing the system to use or not use reputation to choose a se…
Browse files Browse the repository at this point in the history
…rvice provider node
  • Loading branch information
AllanCapistrano committed Mar 24, 2024
1 parent 65cc732 commit fb57df6
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/main/java/reputation/node/models/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -388,13 +388,20 @@ private String getNodeIdWithHighestReputation() {

final Double innerHighestReputation = Double.valueOf(highestReputation);

/**
* Verificando quais nós possuem a maior reputação.
*/
List<ThingReputation> temp = nodesReputations
.stream()
.filter(nr -> nr.getReputation().equals(innerHighestReputation))
.collect(Collectors.toList());
List<ThingReputation> temp;

if (this.useReputation) {
/**
* Verificando quais nós possuem a maior reputação.
*/
temp =
nodesReputations
.stream()
.filter(nr -> nr.getReputation().equals(innerHighestReputation))
.collect(Collectors.toList());
} else {
temp = nodesReputations;
}

/**
* Obtendo o ID de um dos nós com a maior reputação.
Expand Down Expand Up @@ -470,7 +477,7 @@ private DeviceSensorId getDeviceWithHighestReputation(

List<ThingReputation> temp;

if (this.useCredibility) {
if (this.useReputation) {
/**
* Verificando quais dispositivos possuem a maior reputação.
*/
Expand Down

0 comments on commit fb57df6

Please sign in to comment.