@Test public void testPredictAmountOfFragments() { for(int i = 0; i < 10; i++) testCriticalThresholdForPredictAmountOfFragments(i); }
private static int predictAmountOfFragments(int contentLength) { int oldEstimate = 0, newEstimate = 1; while (oldEstimate != newEstimate) { oldEstimate = newEstimate; int hashBlockLengthEstimate = TryteTool.TRYTES_PER_HASH * (oldEstimate-1); newEstimate = (int)Math.ceil((double)(contentLength + hashBlockLengthEstimate)/MAX_CHARS_PER_FRAGMENT); } return newEstimate; }
IAMWriter extends IAMStream { private static int predictAmountOfFragments(int contentLength) { int oldEstimate = 0, newEstimate = 1; while (oldEstimate != newEstimate) { oldEstimate = newEstimate; int hashBlockLengthEstimate = TryteTool.TRYTES_PER_HASH * (oldEstimate-1); newEstimate = (int)Math.ceil((double)(contentLength + hashBlockLengthEstimate)/MAX_CHARS_PER_FRAGMENT); } return newEstimate; } }
IAMWriter extends IAMStream { private static int predictAmountOfFragments(int contentLength) { int oldEstimate = 0, newEstimate = 1; while (oldEstimate != newEstimate) { oldEstimate = newEstimate; int hashBlockLengthEstimate = TryteTool.TRYTES_PER_HASH * (oldEstimate-1); newEstimate = (int)Math.ceil((double)(contentLength + hashBlockLengthEstimate)/MAX_CHARS_PER_FRAGMENT); } return newEstimate; } IAMWriter();  IAMWriter(String id, String privateKeyTrytes); }
IAMWriter extends IAMStream { private static int predictAmountOfFragments(int contentLength) { int oldEstimate = 0, newEstimate = 1; while (oldEstimate != newEstimate) { oldEstimate = newEstimate; int hashBlockLengthEstimate = TryteTool.TRYTES_PER_HASH * (oldEstimate-1); newEstimate = (int)Math.ceil((double)(contentLength + hashBlockLengthEstimate)/MAX_CHARS_PER_FRAGMENT); } return newEstimate; } IAMWriter();  IAMWriter(String id, String privateKeyTrytes); String write(IAMIndex index, JSONObject message); String getID(); String getPrivateKeyTrytes(); }
IAMWriter extends IAMStream { private static int predictAmountOfFragments(int contentLength) { int oldEstimate = 0, newEstimate = 1; while (oldEstimate != newEstimate) { oldEstimate = newEstimate; int hashBlockLengthEstimate = TryteTool.TRYTES_PER_HASH * (oldEstimate-1); newEstimate = (int)Math.ceil((double)(contentLength + hashBlockLengthEstimate)/MAX_CHARS_PER_FRAGMENT); } return newEstimate; } IAMWriter();  IAMWriter(String id, String privateKeyTrytes); String write(IAMIndex index, JSONObject message); String getID(); String getPrivateKeyTrytes();  }