Skip to content

Commit

Permalink
feat: adding credibility header
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanCapistrano committed Mar 9, 2024
1 parent 0783d67 commit 7bb872b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/java/reputation/node/models/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public class Node implements NodeTypeService, ILedgerSubscriber {
private double reputationValue;
private NodeCredibility nodeCredibility;
private CsvWriterService csvWriter;
private String credibilityHeader;
private String[] csvData = new String[8];
private long startedExperiment;
private boolean flagStartedExperiment = true;
Expand All @@ -106,6 +107,7 @@ public void start() {
this.csvWriter.createFile(
String.format("node_%s_credibility", this.nodeType.getNodeId())
);
this.csvWriter.writeData(this.credibilityHeader.split(","));
}

/**
Expand Down Expand Up @@ -1298,4 +1300,12 @@ public void setChangeDisturbingNodeBehaviorTaskTime(
this.changeDisturbingNodeBehaviorTaskTime =
changeDisturbingNodeBehaviorTaskTime;
}

public String getCredibilityHeader() {
return credibilityHeader;
}

public void setCredibilityHeader(String credibilityHeader) {
this.credibilityHeader = credibilityHeader;
}
}
2 changes: 2 additions & 0 deletions src/main/resources/OSGI-INF/blueprint/blueprint.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<property name="useLatestCredibility" value="${useLatestCredibility}" />
<property name="nodeCredibility" ref="nodeCredibility" />
<property name="csvWriter" ref="csvWriterService" />
<property name="credibilityHeader" value="${credibilityHeader}" />
</bean>

<bean id="ledgerConnector" class="reputation.node.tangle.LedgerConnector">
Expand Down Expand Up @@ -73,6 +74,7 @@
<cm:property name="useCredibility" value="true" />
<cm:property name="useLatestCredibility" value="true" />
<cm:property name="debugModeValue" value="true" />
<cm:property name="credibilityHeader" value="Node_ID,C(n),R,Tr(n),Cr_old(n),Cr_new(n),Started_experiment_time,wrote_file_time" />
</cm:default-properties>
</cm:property-placeholder>
</blueprint>
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@ changeDisturbingNodeBehaviorTaskTime=30
useCredibility=true
# Determina se é para usar (true) ou não (false) a credibilidade mais recente para o cálculo da reputação.
useLatestCredibility=true
# Cabeçalho do experimento de credibilidades.
# Obs: Separe somente utilizando vírgula
credibilityHeader=Node_ID,C(n),R,Tr(n),Cr_old(n),Cr_new(n),Started_experiment_time,wrote_file_time

debugModeValue=true

0 comments on commit 7bb872b

Please sign in to comment.