Examples of GapList


Examples of org.jmule.core.sharingmanager.GapList

  static Shell shell;
  static GapListPainter gap_list_painter;
  public static void main(String... args) {
    Display display = Display.getCurrent();
    shell = new Shell(display);
    GapList gap_list = new GapList();
    gap_list.addGap(70, 90);
    gap_list.addGap(1, 20);
    gap_list.addGap(25, 40);
    gap_list_painter = new GapListPainter(gap_list,100);
    FillLayout layout = new FillLayout();
    layout.marginHeight = 10;
    layout.marginWidth  = 10;
    shell.setLayout(layout);
View Full Code Here

Examples of org.jmule.core.sharingmanager.GapList

  void receivedFileChunkRequestFromPeer(Peer sender,
      FileHash fileHash, List<FileChunkRequest> chunkList) {
   
    if (sharedFile instanceof PartialFile) {
      PartialFile partial_file = (PartialFile) sharedFile;
      GapList gapList = partial_file.getGapList();
//      System.out.println("Request from partial file : \n" + partial_file);
      for(FileChunkRequest request : chunkList) {
//        System.out.println("Gap request : " + request+"\nIntersected gaps :");
//        for(Gap gap : gapList.getIntersectedGaps(request.getChunkBegin(), request.getChunkEnd()))
//          System.out.println(gap);
        if (gapList.getIntersectedGaps(request.getChunkBegin(), request.getChunkEnd()).size()!=0) {
          try {
            PeerManagerSingleton.getInstance().disconnect(sender);
          } catch (PeerManagerException e) {
            e.printStackTrace();
          }
View Full Code Here

Examples of org.jmule.core.sharingmanager.GapList

  public void paint(Graphics g) {
      super.paint(g);
    
         long file_size = session.getFileSize();
         long transferred_bytes_count = session.getTransferredBytes();
         GapList gap_list = session.getGapList();
        
     float total_length = this.getWidth();
     float pixels_for_byte = total_length / (float)file_size;
    
     g.setColor(Color.WHITE);
    
       g.fillRect(0, 0, this.getWidth(), 4);
    
       g.setColor(new Color(0,100,199)); // black blue
      
       g.fillRect(0, 0, Math.round((transferred_bytes_count * this.getWidth())/file_size), 4);
      
     //g.setColor(Color.GRAY);
     //System.out.println(pixels_for_byte);
      //g.drawLine(0, 6, this.getWidth(), 6);
      // g.fillRect(2, 2, this.getWidth(), 7);
      g.setColor(Color.WHITE);
      //g.fillRect(0, 1, this.getWidth(), 1);
      g.drawLine(0, 3, this.getWidth(), 3);
      for(Gap gap : gap_list.getGaps()) {
        g.fillRect( Math.round(gap.getStart()*pixels_for_byte),
               4,
               Math.round(gap.getEnd()*pixels_for_byte - gap.getStart()*pixels_for_byte),
               this.getHeight());
      }
View Full Code Here

Examples of org.jmule.core.sharingmanager.GapList

    SharedFile shared_file = _sharing_manager.getSharedFile(fileHash);
    if (shared_file instanceof PartialFile){
      PartialFile partialFile = (PartialFile) shared_file;
      _network_manager.sendFileStatusAnswer(sender.getIP(), sender.getPort(), shared_file.getHashSet(), shared_file.length() ,partialFile.getGapList());
    } else {
      _network_manager.sendFileStatusAnswer(sender.getIP(), sender.getPort(), shared_file.getHashSet(), shared_file.length() ,new GapList());
    }
  }
View Full Code Here

Examples of org.jmule.core.sharingmanager.GapList

        else {
          System.out.println("Null tag!");
          throw new PartMetException("Corrupted tag list in file : " + file.getName() );
        }
      }   
      gapList = new GapList();
      byte tag_id = E2DKConstants.GAP_OFFSET;
      Tag start_tag, end_tag;
      while (true) {
        start_tag = tagList.getTag(new byte[]{FT_GAPSTART[0],tag_id});
        if (start_tag == null) break;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.