Package org.gudy.azureus2.core3.disk.impl.piecemapper

Examples of org.gudy.azureus2.core3.disk.impl.piecemapper.DMPieceMap


  private static DiskManagerFileInfo[] toDMFI(Object[] objects) {
    int count = 0;
    DiskManagerFileInfo[] result = new DiskManagerFileInfo[objects.length];
    for (Object object : objects) {
      if (object instanceof DiskManagerFileInfo) {
        DiskManagerFileInfo fileInfo = (DiskManagerFileInfo) object;
        result[count++] = fileInfo;
      } else if (object instanceof SelectedContent) {
        SelectedContent sc = (SelectedContent) object;
        int fileIndex = sc.getFileIndex();
        if (fileIndex >= 0 && sc.getDownloadManager() != null) {
View Full Code Here


              canStop = true;
            }
          } else {
            DiskManagerFileInfo[] fileInfos = dm.getDiskManagerFileInfo();
            if (fileIndex < fileInfos.length) {
              DiskManagerFileInfo fileInfo = fileInfos[fileIndex];
              if (!canStart && (fileInfo.isSkipped())) {
                canStart = true;
              }
             
              if (!canStop && !fileInfo.isSkipped()) {
                canStop = true;
              }
             
              if (!canRemoveFileInfo && !fileInfo.isSkipped()) {
                int storageType = fileInfo.getStorageType();
                if (storageType == DiskManagerFileInfo.ST_LINEAR
                    || storageType == DiskManagerFileInfo.ST_COMPACT) {
                  canRemoveFileInfo = true;
                }
              }
             
              if (!canRunFileInfo
                  && fileInfo.getAccessMode() == DiskManagerFileInfo.READ
                  && fileInfo.getDownloaded() == fileInfo.getLength()
                  && fileInfo.getFile(true).exists()) {
                canRunFileInfo = true;
              }
            }
          }
        }
View Full Code Here

    DownloadManager dm = (DownloadManager) ds;
    if (rowCore.getSubItemCount() == 0 && dm.getTorrent() != null
        && !dm.getTorrent().isSimpleTorrent() && rowCore.isVisible()
        && dm.getNumFileInfos() > 0) {
      DiskManagerFileInfoSet fileInfos = dm.getDiskManagerFileInfoSet();
      if (fileInfos != null) {
        DiskManagerFileInfo[] files = fileInfos.getFiles();
        boolean copied = false;
        int pos = 0;
        for (int i = 0; i < files.length; i++) {
          DiskManagerFileInfo fileInfo = files[i];
          if (fileInfo.isSkipped()
View Full Code Here

  public static DiskManager
  create(
    TOTorrent    torrent,
    DownloadManager manager)
  {
    DiskManagerImpl dm = new DiskManagerImpl( torrent, manager );
   
    if ( dm.getState() != DiskManager.FAULTY ){
     
      dm.start();
    }
   
    return dm;
  }
View Full Code Here

    // locals are a tiny bit faster
    final boolean firstPiecePriorityL =firstPiecePriority;
    final boolean completionPriorityL =completionPriority;

    final DMPieceMap  pieceMap = diskManager.getPieceMap();
    try
    {
      final boolean rarestOverride = calcRarestAllowed() < 1;
      // calculate all base (starting) priorities for all pieces needing requesting
      final int nbConnects =peerControl.getNbPeers() +peerControl.getNbSeeds();
      for (int i =0; i <nbPieces; i++)
      {
        final DiskManagerPiece dmPiece =dmPieces[i];
        if (dmPiece.isDone())
          continue// nothing to do for pieces not needing requesting

        int startPriority =Integer.MIN_VALUE;

        final DMPieceList pieceList =pieceMap.getPieceList(dmPiece.getPieceNumber());
        final int pieceListSize =pieceList.size();
        for (int j =0; j <pieceListSize; j++)
        {
          final DiskManagerFileInfoImpl fileInfo =pieceList.get(j).getFile();
          final long downloaded =fileInfo.getDownloaded();
View Full Code Here

  }
 
  public DMPieceMap 
  getPieceMap()
  {
    DMPieceMap  map = piece_map_use_accessor;
   
    if ( map == null ){
       
      piece_map_use_accessor = map = piece_mapper.getPieceMap();     
    }
View Full Code Here

 
  public DMPieceList
  getPieceList(
    int  piece_number )
  {
    DMPieceMap  map = getPieceMap();
   
    return( map.getPieceList( piece_number ));
  }
View Full Code Here

        }
        CategoryManager.addCategoryManagerListener(MyTorrentsView.this);
        globalManager.addListener(MyTorrentsView.this, false);
        DownloadManager[] dms = (DownloadManager[]) globalManager.getDownloadManagers().toArray(new DownloadManager[0]);
        for (int i = 0; i < dms.length; i++) {
          DownloadManager dm = dms[i];
          dm.addListener(MyTorrentsView.this);
          if (!isOurDownloadManager(dm)) {
            dms[i] = null;
          }
        }
        tv.addDataSources(dms);
View Full Code Here

        }
      }
    });
    Object[] dms = globalManager.getDownloadManagers().toArray();
    for (int i = 0; i < dms.length; i++) {
      DownloadManager dm = (DownloadManager) dms[i];
      dm.removeListener(this);
    }
    if (currentCategory != null) {
      currentCategory.removeCategoryListener(this);
    }
    CategoryManager.removeCategoryManagerListener(this);
View Full Code Here

          long ttlSize = 0;
          long ttlRSpeed = 0;
          long ttlSSpeed = 0;
          int count = 0;
          for (Iterator iter = dms.iterator(); iter.hasNext();) {
            DownloadManager dm = (DownloadManager) iter.next();

            if (!isInCategory(dm, currentCategory))
              continue;

            count++;
            if (dm.getState() == DownloadManager.STATE_DOWNLOADING
                || dm.getState() == DownloadManager.STATE_SEEDING)
              ttlActive++;
            ttlSize += dm.getSize();
            ttlRSpeed += dm.getStats().getDataReceiveRate();
            ttlSSpeed += dm.getStats().getDataSendRate();
          }

          String up_details = "";
          String down_details = "";
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.core3.disk.impl.piecemapper.DMPieceMap

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.