Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 478bea7

Browse files
authored
Merge pull request #139 from kwek20/more-javadoc
Updates javadoc of IotaApi and IotaApiCore
2 parents 924a067 + 16a99f6 commit 478bea7

13 files changed

+783
-336
lines changed

jota/src/main/java/jota/IotaAPI.java

+343-180
Large diffs are not rendered by default.

jota/src/main/java/jota/IotaAPICore.java

+192-69
Large diffs are not rendered by default.

jota/src/main/java/jota/dto/request/IotaCommandRequest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public static IotaCommandRequest createGetNeighborsRequest() {
4646
/**
4747
* Interrupt attaching to the tangle
4848
*
49-
* @return
49+
* @return The interrupted attach command
5050
*/
5151
public static IotaCommandRequest createInterruptAttachToTangleRequest() {
5252
return new IotaCommandRequest(IotaAPICommands.INTERRUPT_ATTACHING_TO_TANGLE);

jota/src/main/java/jota/dto/request/IotaWereAddressesSpentFromRequest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public String[] getAddresses() {
3838
/**
3939
* Sets the addresses.
4040
*
41-
* @param trytes The addresses.
41+
* @param addresses The addresses.
4242
*/
4343
public void setAddresses(String[] addresses) {
4444
this.addresses = addresses;
Original file line numberDiff line numberDiff line change
@@ -1,180 +1,323 @@
11
package jota.dto.response;
22

33
/**
4-
* Response of {@link jota.dto.request.IotaNeighborsRequest}.
5-
**/
4+
*
5+
* Contains information about the result of a successful {@code getNodeInfo} API call.
6+
*
7+
*/
68
public class GetNodeInfoResponse extends AbstractResponse {
79

10+
/**
11+
* Name of the IOTA software you're currently using. (IRI stands for IOTA Reference Implementation)
12+
*/
813
private String appName;
14+
15+
/**
16+
* The version of the IOTA software this node is running.
17+
*/
918
private String appVersion;
10-
private String jreVersion;
19+
20+
/**
21+
* Available cores for JRE on this node.
22+
*/
1123
private int jreAvailableProcessors;
24+
25+
/**
26+
* The amount of free memory in the Java Virtual Machine.
27+
*/
1228
private long jreFreeMemory;
29+
30+
/**
31+
* The JRE version this node runs on
32+
*/
33+
private String jreVersion;
34+
35+
/**
36+
* The maximum amount of memory that the Java virtual machine will attempt to use.
37+
*/
1338
private long jreMaxMemory;
39+
40+
/**
41+
* The total amount of memory in the Java virtual machine.
42+
*/
1443
private long jreTotalMemory;
44+
45+
/**
46+
* The hash of the latest transaction that was signed off by the coordinator.
47+
*/
1548
private String latestMilestone;
49+
50+
/**
51+
* Index of the {@link #latestMilestone}
52+
*/
1653
private int latestMilestoneIndex;
54+
55+
/**
56+
* The hash of the latest transaction which is solid and is used for sending transactions.
57+
* For a milestone to become solid, your local node must approve the subtangle of coordinator-approved transactions,
58+
* and have a consistent view of all referenced transactions.
59+
*/
1760
private String latestSolidSubtangleMilestone;
61+
62+
/**
63+
* Index of the {@link #latestSolidSubtangleMilestone}
64+
*/
1865
private int latestSolidSubtangleMilestoneIndex;
66+
67+
/**
68+
* The start index of the milestones.
69+
* This index is encoded in each milestone transaction by the coordinator
70+
*/
71+
private int milestoneStartIndex;
72+
73+
/**
74+
* Number of neighbors this node is directly connected with.
75+
*/
1976
private int neighbors;
77+
78+
/**
79+
* The amount of transaction packets which are currently waiting to be broadcast.
80+
*/
2081
private int packetsQueueSize;
82+
83+
/**
84+
* The difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC
85+
*/
2186
private long time;
87+
88+
/**
89+
* Number of tips in the network.
90+
*/
2291
private int tips;
92+
93+
/**
94+
* When a node receives a transaction from one of its neighbors,
95+
* this transaction is referencing two other transactions t1 and t2 (trunk and branch transaction).
96+
* If either t1 or t2 (or both) is not in the node's local database,
97+
* then the transaction hash of t1 (or t2 or both) is added to the queue of the "transactions to request".
98+
* At some point, the node will process this queue and ask for details about transactions in the
99+
* "transaction to request" queue from one of its neighbors.
100+
* This number represents the amount of "transaction to request"
101+
*/
23102
private int transactionsToRequest;
24103

104+
/**
105+
* Every node can have features enabled or disabled.
106+
* This list will contain all the names of the features of a node as specified in {@link Feature}.
107+
*/
25108
private String[] features;
109+
110+
/**
111+
* The address of the Coordinator being followed by this node.
112+
*/
113+
private String coordinatorAddress;
26114

27115
/**
28-
* The name of the IOTA software the node currently running (IRI stands for Initial Reference Implementation).
29-
*
30-
* @return appName
116+
* Creates a new {@link GetNodeInfoResponse}
117+
*
118+
* @param appName {@link #appName}
119+
* @param appVersion {@link #appVersion}
120+
* @param jreAvailableProcessors {@link #jreAvailableProcessors}
121+
* @param jreFreeMemory {@link #jreFreeMemory}
122+
* @param jreVersion {@link #jreVersion}
123+
* @param maxMemory {@link #jreMaxMemory}
124+
* @param totalMemory {@link #jreTotalMemory}
125+
* @param latestMilestone {@link #latestMilestone}
126+
* @param latestMilestoneIndex {@link #latestMilestoneIndex}
127+
* @param latestSolidSubtangleMilestone {@link #latestSolidSubtangleMilestone}
128+
* @param latestSolidSubtangleMilestoneIndex {@link #latestSolidSubtangleMilestoneIndex}
129+
* @param milestoneStartIndex {@link #milestoneStartIndex}
130+
* @param neighbors {@link #neighbors}
131+
* @param packetsQueueSize {@link #packetsQueueSize}
132+
* @param currentTimeMillis {@link #time}
133+
* @param tips {@link #tips}
134+
* @param numberOfTransactionsToRequest {@link #transactionsToRequest}
135+
* @param features {@link #features}
136+
* @param coordinatorAddress {@link #coordinatorAddress}
137+
* @return a {@link GetNodeInfoResponse} filled with all the provided parameters
31138
*/
32-
public String getAppName() {
33-
return appName;
139+
public static AbstractResponse create(String appName, String appVersion, int jreAvailableProcessors, long jreFreeMemory,
140+
String jreVersion, long maxMemory, long totalMemory, String latestMilestone, int latestMilestoneIndex,
141+
String latestSolidSubtangleMilestone, int latestSolidSubtangleMilestoneIndex, int milestoneStartIndex,
142+
int neighbors, int packetsQueueSize, long currentTimeMillis, int tips,
143+
int numberOfTransactionsToRequest, String[] features, String coordinatorAddress) {
144+
final GetNodeInfoResponse res = new GetNodeInfoResponse();
145+
res.appName = appName;
146+
res.appVersion = appVersion;
147+
res.jreAvailableProcessors = jreAvailableProcessors;
148+
res.jreFreeMemory = jreFreeMemory;
149+
res.jreVersion = jreVersion;
150+
151+
res.jreMaxMemory = maxMemory;
152+
res.jreTotalMemory = totalMemory;
153+
res.latestMilestone = latestMilestone;
154+
res.latestMilestoneIndex = latestMilestoneIndex;
155+
156+
res.latestSolidSubtangleMilestone = latestSolidSubtangleMilestone;
157+
res.latestSolidSubtangleMilestoneIndex = latestSolidSubtangleMilestoneIndex;
158+
159+
res.milestoneStartIndex = milestoneStartIndex;
160+
161+
res.neighbors = neighbors;
162+
res.packetsQueueSize = packetsQueueSize;
163+
res.time = currentTimeMillis;
164+
res.tips = tips;
165+
res.transactionsToRequest = numberOfTransactionsToRequest;
166+
167+
res.features = features;
168+
res.coordinatorAddress = coordinatorAddress;
169+
return res;
34170
}
35171

36172
/**
37-
* The version of the IOTA software the node currently running.
38-
*
39-
* @return The version of the IOTA software the node currently running.
173+
*
174+
* @return {@link #appName}
40175
*/
41-
public String getAppVersion() {
42-
return appVersion;
176+
public String getAppName() {
177+
return appName;
43178
}
44-
179+
45180
/**
46-
* The version of running java version.
47-
*
48-
* @return The version of running java version.
181+
*
182+
* @return {@link #appVersion}
49183
*/
50-
public String getJreVersion() {
51-
return jreVersion;
184+
public String getAppVersion() {
185+
return appVersion;
52186
}
53187

54188
/**
55-
* Available cores on the node currently running.
56189
*
57-
* @return Available cores on the machine for JRE.
190+
* @return {@link #jreAvailableProcessors}
58191
*/
59-
public Integer getJreAvailableProcessors() {
192+
public int getJreAvailableProcessors() {
60193
return jreAvailableProcessors;
61194
}
62195

63196
/**
64-
* The amount of free memory in the Java Virtual Machine.
65-
*
66-
* @return The amount of free memory in the Java Virtual Machine.
197+
*
198+
* @return {@link #jreFreeMemory}
67199
*/
68200
public long getJreFreeMemory() {
69201
return jreFreeMemory;
70202
}
71203

72204
/**
73-
* The maximum amount of memory that the Java virtual machine will attempt to use.
74205
*
75-
* @return The maximum amount of memory that the Java virtual machine will attempt to use.
206+
* @return {@link #jreMaxMemory}
76207
*/
77208
public long getJreMaxMemory() {
78209
return jreMaxMemory;
79210
}
80211

81212
/**
82-
* The total amount of memory in the Java virtual machine.
83213
*
84-
* @return The total amount of memory in the Java virtual machine.
214+
* @return {@link #jreTotalMemory}
85215
*/
86216
public long getJreTotalMemory() {
87217
return jreTotalMemory;
88218
}
89219

90220
/**
91-
* Latest milestone that was signed off by the coordinator.
92221
*
93-
* @return Latest milestone that was signed off by the coordinator.
222+
* @return {@link #jreVersion}
223+
*/
224+
public String getJreVersion() {
225+
return jreVersion;
226+
}
227+
228+
/**
229+
*
230+
* @return {@link #latestMilestone}
94231
*/
95232
public String getLatestMilestone() {
96233
return latestMilestone;
97234
}
98235

99236
/**
100-
* Index of the latest milestone.
101-
*
102-
* @return Index of the latest milestone.
237+
*
238+
* @return {@link #latestMilestoneIndex}
103239
*/
104240
public int getLatestMilestoneIndex() {
105241
return latestMilestoneIndex;
106242
}
107243

108244
/**
109-
* The latest milestone which is solid and is used for sending transactions.
110-
* For a milestone to become solid the local node must basically approve the subtangle of coordinator-approved transactions,
111-
* and have a consistent view of all referenced transactions.
112-
*
113-
* @return The latest milestone which is solid and is used for sending transactions.
245+
*
246+
* @return {@link #latestSolidSubtangleMilestone}
114247
*/
115248
public String getLatestSolidSubtangleMilestone() {
116249
return latestSolidSubtangleMilestone;
117250
}
118251

119252
/**
120-
* Index of the latest solid subtangle.
121-
*
122-
* @return Index of the latest solid subtangle.
253+
*
254+
* @return {@link #latestSolidSubtangleMilestoneIndex}
123255
*/
124256
public int getLatestSolidSubtangleMilestoneIndex() {
125257
return latestSolidSubtangleMilestoneIndex;
126258
}
127259

128260
/**
129-
* Number of neighbors the node connected with.
130261
*
131-
* @return Number of neighbors the node connected with.
262+
* @return {@link #milestoneStartIndex}
263+
*/
264+
public int getMilestoneStartIndex() {
265+
return milestoneStartIndex;
266+
}
267+
268+
/**
269+
*
270+
* @return {@link #neighbors}
132271
*/
133272
public int getNeighbors() {
134273
return neighbors;
135274
}
136275

137276
/**
138-
* Packets which are currently queued up.
139277
*
140-
* @return Packets which are currently queued up.
278+
* @return {@link #packetsQueueSize}
141279
*/
142280
public int getPacketsQueueSize() {
143281
return packetsQueueSize;
144282
}
145283

146284
/**
147-
* Current UNIX timestamp.
148285
*
149-
* @return Current UNIX timestamp.
286+
* @return {@link #time}
150287
*/
151-
public Long getTime() {
288+
public long getTime() {
152289
return time;
153290
}
154291

155292
/**
156-
* Number of tips in the network.
157293
*
158-
* @return Number of tips in the network.
294+
* @return {@link #tips}
159295
*/
160296
public int getTips() {
161297
return tips;
162298
}
163299

164300
/**
165-
* Transactions to request during syncing process.
166301
*
167-
* @return Transactions to request during syncing process.
302+
* @return {@link #transactionsToRequest}
168303
*/
169304
public int getTransactionsToRequest() {
170305
return transactionsToRequest;
171306
}
172307

173308
/**
174309
*
175-
* @return
310+
* @return {@link #features}
176311
*/
177312
public String[] getFeatures() {
178313
return features;
179314
}
180-
}
315+
316+
/**
317+
*
318+
* @return {@link #coordinatorAddress}
319+
*/
320+
public String getCoordinatorAddress() {
321+
return coordinatorAddress;
322+
}
323+
}

0 commit comments

Comments
 (0)