Merkle Thread Java Programming Project

User Generated

uvfunz232

Programming

Description

Unformatted Attachment Preview

iii. Merkle Thread 1. This class must implement Runnable. a. 2. Instance variables: Public & static & volatile ArrayList that holds all the grabbed words. i. Example: 1. public static volatile ArrayList IstWords; b. Private int called iMerkleTreelnputs for how many words to wait for before creating a merkle tree. i. Set it equal to 4. a. C. 3. Method: A public "run" method that is triggered when "start" is called from MerkleManager. No inputs or outputs. b. Instantiate a Util class object (Util class is defined lower down). Instantiate the ArrayList instance variable. i. Example: 1. IstWords = new ArrayList(); ii. Create a neverending while loop like this: 1. while(true){... 2. In loop, do all the following: Call sleepRandom Time on util variable. b. Cal grabWord on MerkleManager. i. Example of how to call static method: String sNewWord = MerkleManager.grabWord(); Then if sNewWord is not null: i. Print out that Merkle grabbed a word. ii. Add word to IstWords like this: IstWords.add(sNewWord); iii. Check if IstWords.size() is equal to iMerkleTreelnputs. iv. And if true, then set Merkle Manager.sMerkleRoot to the merkle root generated by the getMerkleRoot method on util class. a. = C.
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

View attached explanation and answer. Let me know if you have any questions.

import java.util.ArrayList;
public class MerkleThread implements Runnable{
public static volatile ArrayList grabbedWords;
private int iMerkleTreeInputs = 4;
// how many words to wait for before tree gets created
@Override
public void run() {
Util oUtil = new Util();
grabbe...


Anonymous
Just what I needed…Fantastic!

Studypool
4.7
Indeed
4.5
Sitejabber
4.4

Related Tags