Skip to content

Commit

Permalink
feat: using ChangeDisturbingNodeBehaviorTask
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanCapistrano committed Feb 14, 2024
1 parent ef6fff9 commit 431a5f2
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/main/java/reputation/node/models/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import reputation.node.reputation.credibility.NodeCredibility;
import reputation.node.services.NodeTypeService;
import reputation.node.tangle.LedgerConnector;
import reputation.node.tasks.ChangeDisturbingNodeBehaviorTask;
import reputation.node.tasks.CheckDevicesTask;
import reputation.node.tasks.CheckNodesServicesTask;
import reputation.node.tasks.RequestDataTask;
Expand All @@ -63,6 +64,7 @@ public class Node implements NodeTypeService, ILedgerSubscriber {
private int waitDeviceResponseTaskTime;
private int checkNodesServicesTaskTime;
private int waitNodesResponsesTaskTime;
private int changeDisturbingNodeBehaviorTaskTime;
private List<Device> devices;
private List<Transaction> nodesWithServices;
private LedgerConnector ledgerConnector;
Expand Down Expand Up @@ -689,6 +691,19 @@ private void createTasks() {
0,
this.checkNodesServicesTaskTime * 1000
);
new Timer()
.scheduleAtFixedRate(
new ChangeDisturbingNodeBehaviorTask(
this,
new ReputationUsingKMeans(
this.kMeans,
this.nodeCredibility,
this.getNodeType().getNodeId()
)
),
0,
this.changeDisturbingNodeBehaviorTaskTime * 1000
);
}

/**
Expand Down Expand Up @@ -1249,4 +1264,15 @@ public double getReputationValue() {
public void setReputationValue(double reputationValue) {
this.reputationValue = reputationValue;
}

public int getChangeDisturbingNodeBehaviorTaskTime() {
return changeDisturbingNodeBehaviorTaskTime;
}

public void setChangeDisturbingNodeBehaviorTaskTime(
int changeDisturbingNodeBehaviorTaskTime
) {
this.changeDisturbingNodeBehaviorTaskTime =
changeDisturbingNodeBehaviorTaskTime;
}
}

0 comments on commit 431a5f2

Please sign in to comment.