Package org.jmule.core.jkad

Examples of org.jmule.core.jkad.Int128


    int biggerRang = -1;
   
    for(int i = 0;i<contactList.size();i++) {
      KadContact contact = contactList.get(i);
      if (exceptList.contains(contact)) continue;
      Int128 distance = XOR(targetID, contact.getContactDistance());
      if (result==-1) {
        result = i;
        biggerRang = getBiggerRang(distance.getBitSet());
        continue;
      }
      int rang = getBiggerRang(distance.getBitSet());
      if (rang<biggerRang) {
        result = i;
        biggerRang = rang;
      }
     
View Full Code Here


    input.put(inputData);
    input.position(0);
    md4.update(input);
    ByteBuffer output = Misc.getByteBuffer(16);
    md4.finalDigest(output);
    return new Int128(output.array());
  }
View Full Code Here

  }
 
  public Int128 searchKeyword(String keyword, SearchResultListener listener) {
    byte[] tmp = MD4.MD4Digest(keyword.getBytes()).toByteArray();
    Convert.updateSearchID(tmp);
    Int128 keywordID = new Int128(tmp);
   
    if (searchTasks.containsKey(keywordID)) return null;
    KeywordSearchTask search_task = new KeywordSearchTask(keywordID);
    search_task.setSearchKeyword(keyword);
    search_task.setSearchResultListener(listener);
View Full Code Here

  }
 
  public void searchNotes(Int128 fileID,SearchResultListener listener) {
    byte[] t = fileID.toByteArray();
    Convert.updateSearchID(t);
    Int128 updatedID = new Int128(t);
    if (searchTasks.containsKey(updatedID)) return;
    NoteSearchTask search_task = new NoteSearchTask( updatedID);
    search_task.setSearchResultListener(listener);
    searchTasks.put(updatedID, search_task);
    search_task.startSearch();
View Full Code Here

        Search search = Search.getSingleton();

        public void run() {
          byte[] hash = sharedFile.getFileHash().getHash().clone();
          org.jmule.core.jkad.utils.Convert.updateSearchID(hash);
          search_id = new Int128(hash);
          if (search.hasSearchTask(search_id))
            return;
          Search.getSingleton().searchSources(search_id,
              new SearchResultListener() {
                public void processNewResults(
View Full Code Here

  /**
   * Split node into two sub nodes when KBucket is full
   */
  private void splitNode() {
    Int128 left_index = nodeIndex.clone();
    left_index.setBit(nodeLevel, false);
   
    Int128 right_index = nodeIndex.clone();
    right_index.setBit(nodeLevel, true);
   
    KBucket left_subnet = new KBucket();
    KBucket righ_subnet = new KBucket();
   
    for(KadContact contact : subnet.getContacts()) {
View Full Code Here

TOP

Related Classes of org.jmule.core.jkad.Int128

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.