コード例 #1
0
  public void testReceivedCodedBatch() {
    System.out.println("Starting with content size " + _contentSize + " ...");
    int n = _sourceCodedBatch.getRequiredCodedPieceCount();

    {
      CodedPiece[] css = new CodedPiece[n];
      for (int i = 0; i < n; i++) {
        System.out.print("Coding...");
        long codingStart = System.currentTimeMillis();
        css[i] = _sourceCodedBatch.code();
        long codingEnd = System.currentTimeMillis();
        System.out.println("(" + (codingEnd - codingStart) + ")");
      }

      System.out.println("Receiving...");
      for (int i = 0; i < n; i++) _receivedCodedBatch.addCodedSlice(css[i]);
    }

    //		{
    //			System.out.print("Checking solvability...");
    //			long solvabilityStart = SystemTime.currentTimeMillis();
    //			CodedSlice[] solvingSlices = _receivedCodedBatch.canSolve();
    //			long solvabilityEnd = System.currentTimeMillis();
    //			System.out.println("(" + (solvabilityEnd - solvabilityStart) + ")");
    //		}

    {
      System.out.println(_sourceCodedBatch);
      System.out.println(_receivedCodedBatch);
    }

    {
      System.out.print("Decoding...");
      long decodeStart = System.currentTimeMillis();
      boolean decode = _receivedCodedBatch.decode();
      long decodeEnd = System.currentTimeMillis();
      System.out.println(":" + decode + "(" + (decodeEnd - decodeStart) + ")");
    }

    System.out.println("Printing...");
    System.out.println(_receivedCodedBatch);
    System.out.println("Ending...");

    System.out.println(_sourceCodedBatch.equals(_receivedCodedBatch));
  }
コード例 #2
0
  public void setUp() {
    _content = new byte[_contentSize];
    for (int i = 0; i < _contentSize; i++) _content[i] = (byte) i;

    _sourceCodedBatch =
        new SourceCodedBatch(BulkMatrix1D.createBulkMatrix1D(_content, 0, _contentSize));

    _receivedCodedBatch =
        new ReceivedCodedBatch(_sourceCodedBatch._size, _sourceCodedBatch.getBulkMatrix()._rows);
  }