Package dijjer.util

Examples of dijjer.util.VeryLongIntegerKey


      byte[] bytes = new byte[Store.DATA_BLOCK_SIZE];
      byteList.add(bytes);
      for (int y = 0; y < bytes.length; y++) {
        bytes[y] = (byte) x;
      }
      _ds.addDataAsBlock(new VeryLongIntegerKey((long) 0, (long) x), bytes);
    }
  }
View Full Code Here


    for (int x = 0; x < 15; x++) {
      byte[] b = new byte[Store.DATA_BLOCK_SIZE];
      for (int y = 0; y < b.length; y++) {
        b[y] = (byte) x;
      }
      _ds.addDataAsBlock(new VeryLongIntegerKey((long) 0, (long) x), b);
    }
    _ds.getDataForBlock(new VeryLongIntegerKey((long) 0, (long) 7));
    for (int x = 15; x < 20; x++) {
      byte[] b = new byte[Store.DATA_BLOCK_SIZE];
      for (int y = 0; y < b.length; y++) {
        b[y] = (byte) x;
      }
      _ds.addDataAsBlock(new VeryLongIntegerKey((long) 0, (long) x), b);
    }

  }
View Full Code Here

    _blockNo = blockNo;
  }

  public VeryLongIntegerKey getHashHashKey() {
    if (_hashHash == null) {
      _hashHash = new VeryLongIntegerKey(_url.toString() + ":" + _fileLength + ":" + _lastModified + ":" + _blockNo
          + "-hash");
    }
    return _hashHash;
  }
View Full Code Here

    return _hashHash;
  }

  public VeryLongIntegerKey getHashKey() {
    if (_hash == null) {
      _hash = new VeryLongIntegerKey(_url.toString() + ":" + _fileLength + ":" + _lastModified + ":" + _blockNo);
    }
    return _hash;
  }
View Full Code Here

    _hs.close();
  }
 
  public void testHashStore() throws Exception {
    for (int x=0; x<HS_INSERTS; x++) {
      VeryLongIntegerKey key = new VeryLongIntegerKey(x,x);
      VeryLongInteger hash = new VeryLongInteger(x*x, x*x);
      _hs.put(key, hash);
    }
   
    _hs.close();
   
    assertEquals("File length doesn't correspond to HashStore size", _index.length(), HS_SIZE*40);
   
    _hs = new HashStore(_index, HS_SIZE);
   
    VeryLongInteger v = _hs.getHash(new VeryLongIntegerKey(2,2));
    assertEquals("Retrieved VLI was not as expected", v, new VeryLongInteger(4,4));

    // This shouldn't be in there any more as it should have been displayed
    v = _hs.getHash(new VeryLongIntegerKey(0,0));
    assertNull("Object should have been deleted, but wasn't", v);
   
    _hs.put(new VeryLongIntegerKey(20, 20), new VeryLongInteger(400, 400));
   
    v = _hs.getHash(new VeryLongIntegerKey(3,3));
    assertNull("Object should have been deleted, but wasn't", v);
   
    v = _hs.getHash(new VeryLongIntegerKey(2,2));
   
    assertNotNull("Object should have been retained, but wasn't", v);
    assertEquals("Retrieved VLI was not as expected", v, new VeryLongInteger(4,4));
   
    _hs.close();
   
    _hs = new HashStore(_index, HS_SIZE);
   
    v = _hs.getHash(new VeryLongIntegerKey(4,4));
    assertNotNull("Failed to retrieve hash", v);
    assertEquals("Retrieved VLI is not as expected", v, new VeryLongInteger(16, 16));
   
    v = _hs.getHash(new VeryLongIntegerKey(3,3));
    assertNull(v);
   
    _hs.delete(new VeryLongIntegerKey(4,4));
    assertNull(_hs.getHash(new VeryLongIntegerKey(4,4)));
   
    _hs.close();
   
    _hs = new HashStore(_index, HS_SIZE);
   
    assertNull(_hs.getHash(new VeryLongIntegerKey(4,4)));
   
    v = _hs.getHash(new VeryLongIntegerKey(2,2));
   
    assertNotNull("Object should have been retained, but wasn't", v);
    assertEquals("Retrieved VLI was not as expected", v, new VeryLongInteger(4,4));
  }
View Full Code Here

TOP

Related Classes of dijjer.util.VeryLongIntegerKey

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.