Skip to content

Commit

Permalink
feat: adding reputation to CSV file
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanCapistrano committed Mar 24, 2024
1 parent 4468315 commit 219cbca
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/main/java/reputation/node/models/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public class Node implements NodeTypeService, ILedgerSubscriber {
private NodeCredibility nodeCredibility;
private CsvWriterService csvWriter;
private String credibilityHeader;
private String[] csvData = new String[10];
private String[] csvData = new String[11];
private long startedExperiment;
private boolean flagStartedExperiment = true;
private boolean changeDisturbingNodeBehaviorFlag = false;
Expand Down Expand Up @@ -780,7 +780,7 @@ private void createTasks() {
0,
this.calculateNodeReputationTaskTime * 1000
);

/* Somente se um nó do tipo perturbador. */
if (this.getNodeType().getType().toString().equals("DISTURBING")) {
new Timer()
Expand Down Expand Up @@ -930,6 +930,8 @@ private float calculateCredibility(
this.csvData[7] = String.valueOf(startedExperiment);
/* Salvando o tempo em que calculou a nova credibilidade. */
this.csvData[8] = String.valueOf(System.currentTimeMillis());
/* Salvando a reputação do nó */
this.csvData[10] = String.valueOf(this.reputationValue);

/* Escrevendo na blockchain a credibilidade calculado do nó avaliador */
try {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/OSGI-INF/blueprint/blueprint.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<cm:property name="useLatestCredibility" value="true" />
<cm:property name="useReputation" value="true" />
<cm:property name="debugModeValue" value="true" />
<cm:property name="credibilityHeader" value="Node_ID,Type,C(n),R,Tr(n),Cr_old(n),Cr_new(n),Started_experiment_time,wrote_file_time,Node_provider_ID" />
<cm:property name="credibilityHeader" value="Node_ID,Type,C(n),R,Tr(n),Cr_old(n),Cr_new(n),Started_experiment_time,wrote_file_time,Node_provider_ID,Reputation" />
</cm:default-properties>
</cm:property-placeholder>
</blueprint>
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ useLatestCredibility=true
useReputation=true
# Cabeçalho do experimento de credibilidades.
# Obs: Separe somente utilizando vírgula
credibilityHeader=Node_ID,Type,C(n),R,Tr(n),Cr_old(n),Cr_new(n),Started_experiment_time,wrote_file_time,Node_provider_ID
credibilityHeader=Node_ID,Type,C(n),R,Tr(n),Cr_old(n),Cr_new(n),Started_experiment_time,wrote_file_time,Node_provider_ID,Reputation

debugModeValue=true

0 comments on commit 219cbca

Please sign in to comment.