Package org.gudy.azureus2.core3.peer

Examples of org.gudy.azureus2.core3.peer.PEPeer


      CAT_BYTES,
    });
  }

  public void refresh(TableCell cell) {
    PEPeer peer = (PEPeer)cell.getDataSource();
    long value = (peer == null) ? 0 : peer.getStats().getEstimatedDownloadRateOfPeer();

    if (!cell.setSortValue(value) && cell.isValid())
      return;

    cell.setText(DisplayFormatters.formatByteCountToKiBEtcPerSec(value));
View Full Code Here


    super(COLUMN_ID, ALIGN_TRAIL, POSITION_INVISIBLE, 60, table_id);
    setRefreshInterval(INTERVAL_LIVE);
  }

  public void refresh(TableCell cell) {
    PEPeer peer = (PEPeer)cell.getDataSource();
    long value = (peer == null) ? 0 : peer.getStats().getTotalBytesDiscarded();

    if (!cell.setSortValue(value) && cell.isValid())
      return;

    cell.setText(DisplayFormatters.formatByteCountToKiBEtc(value));
View Full Code Here

    super(COLUMN_ID, ALIGN_CENTER, POSITION_INVISIBLE, 50, table_id);
    setRefreshInterval(INTERVAL_LIVE);
  }

  public void refresh(TableCell cell) {
    PEPeer peer = (PEPeer)cell.getDataSource();
    String value = peer == null ? "" : peer.getEncryption();

    if (!cell.setSortValue(value) && cell.isValid())
      return;

    cell.setText(value);
View Full Code Here

      CAT_TIME,
    });
  }

  public void refresh(TableCell cell) {
    PEPeer peer = (PEPeer)cell.getDataSource();
    long value = (peer == null) ? 0 : peer.getUploadHint();
   
    Comparable sortValue = cell.getSortValue();
    long oldValue = 0;
    if (sortValue instanceof Number) {
      oldValue = ((Number)sortValue).longValue();
View Full Code Here

      CAT_BYTES,
    });
  }

  public void refresh(TableCell cell) {
    PEPeer peer = (PEPeer)cell.getDataSource();
    long value = (peer == null) ? 0 : peer.getStats().getEstimatedUploadRateOfPeer();

    if (!cell.setSortValue(value) && cell.isValid())
      return;

    cell.setText(DisplayFormatters.formatByteCountToKiBEtcPerSec(value));
View Full Code Here

    int iAngle = 0;
    double currentPerimeter = 0;   
    double angle,r;  

    for(int i = 0 ; i < nbPeers ; i++) {
      PEPeer peer = sortedPeers[i];
      do {
        angle = angles[iAngle];
        r     = rs[iAngle];
        currentPerimeter += r;
        if(iAngle + 1 < NB_ANGLES) iAngle++;
      } while( currentPerimeter < i * perimeter / nbPeers);
           
      angle = (4 * i - nbPeers) * Math.PI  / (2 * nbPeers) - Math.PI / 2;
     
      int[] triangle = new int[6];
     
     
      int percent_received   = peer.getPercentDoneOfCurrentIncomingRequest();
      int percent_sent     = peer.getPercentDoneOfCurrentOutgoingRequest();

        // set up base line state
     

      boolean  drawLine = false;
     
        // unchoked
     
      if ( !peer.isChokingMe() || percent_received >= 0 ){
        gcBuffer.setForeground(Colors.blues[1] );
       drawLine = true;
      }

        // unchoking
     
      if ( !peer.isChokedByMe() || percent_sent >= 0 ){
      gcBuffer.setForeground(Colors.blues[3]);
      drawLine = true;
      }
        
        // receiving from choked peer (fast request in)
     
      if ( !peer.isChokingMe() && peer.isUnchokeOverride() && peer.isInteresting()){
      gcBuffer.setForeground(Colors.green);
      drawLine = true;
      }
     
        // sending to choked peer (fast request out)
     
      if ( peer.isChokedByMe() && percent_sent >= 0 ){
      gcBuffer.setForeground(Colors.green);
      drawLine = true;
      }
     
      if ( drawLine ){
    int x1 = x0 + (int) ( r * deltaYXs[iAngle] );
    int y1 = y0 + (int) ( r * deltaYYs[iAngle] );       
    gcBuffer.drawLine(x0,y0,x1,y1);
      }   
     
     
     
      if(percent_received >= 0) {
        gcBuffer.setBackground(Colors.blues[Colors.BLUES_MIDDARK]);
        double r1 = r - r * percent_received / 100;
        triangle[0] = (int) (x0 + (r1-10) * deltaYXs[iAngle] + 0.5);
        triangle[1] = (int) (y0 + (r1-10) * deltaYYs[iAngle] + 0.5);
       
        triangle[2] (int) (x0 + deltaXXs[iAngle] * 4 + (r1) * deltaYXs[iAngle] + 0.5);
        triangle[3] (int) (y0 + deltaXYs[iAngle] * 4 + (r1) * deltaYYs[iAngle] + 0.5);
       
       
        triangle[4] (int) (x0 - deltaXXs[iAngle] * 4 + (r1) * deltaYXs[iAngle] + 0.5);
        triangle[5] (int) (y0 - deltaXYs[iAngle] * 4 + (r1) * deltaYYs[iAngle] + 0.5);
       
        gcBuffer.fillPolygon(triangle);
      }
     
     
     
      if(percent_sent >= 0) {
        gcBuffer.setBackground(Colors.blues[Colors.BLUES_MIDLIGHT]);
        double r1 = r * percent_sent / 100;
        triangle[0] = (int) (x0 + r1 * deltaYXs[iAngle] + 0.5);
        triangle[1] = (int) (y0 + r1 * deltaYYs[iAngle] + 0.5);
       
        triangle[2] (int) (x0 + deltaXXs[iAngle] * 4 + (r1-10) * deltaYXs[iAngle] + 0.5);
        triangle[3] (int) (y0 + deltaXYs[iAngle] * 4 + (r1-10) * deltaYYs[iAngle] + 0.5);
       
       
        triangle[4] (int) (x0 - deltaXXs[iAngle] * 4 + (r1-10) * deltaYXs[iAngle] + 0.5);
        triangle[5] (int) (y0 - deltaXYs[iAngle] * 4 + (r1-10) * deltaYYs[iAngle] + 0.5);
        gcBuffer.fillPolygon(triangle);
      }
     
     
     
      int x1 = x0 + (int) (r * deltaYXs[iAngle]);
      int y1 = y0 + (int) (r * deltaYYs[iAngle]);
      gcBuffer.setBackground(Colors.blues[Colors.BLUES_MIDDARK]);
      if(peer.isSnubbed()) {
        gcBuffer.setBackground(Colors.grey);
      }
     
      /*int PS = (int) (PEER_SIZE);     
        if (deltaXY == 0) {
          PS = (int) (PEER_SIZE * 2);
        } else {
          if (deltaYY > 0) {
            PS = (int) (PEER_SIZE / deltaXY);
          }
        }*/
      //PieUtils.drawPie(gcBuffer,(x1 - PS / 2),y1 - PS / 2,PS,PS,peer.getPercentDoneInThousandNotation() / 10);
      PieUtils.drawPie(gcBuffer,x1 - PEER_SIZE / 2,y1 - PEER_SIZE / 2,PEER_SIZE,PEER_SIZE,peer.getPercentDoneInThousandNotation() / 10);
     
      //gcBuffer.drawText(peer.getIp() , x1 + 8 , y1 , true);
    }
   
    gcBuffer.setBackground(Colors.blues[Colors.BLUES_MIDDARK]);
View Full Code Here

  /* (non-Javadoc)
   * @see org.gudy.azureus2.plugins.ui.tables.TableCellRefreshListener#refresh(org.gudy.azureus2.plugins.ui.tables.TableCell)
   */
  public void refresh(TableCell cell) {
    PEPeer peer = (PEPeer)cell.getDataSource();
    if (peer == null) {cell.setText(""); return;}
    PEPeerManager manager = peer.getManager();
    if (manager == null) {cell.setText(""); return;}
    cell.setText(manager.getDisplayName());
  }
View Full Code Here

    super(COLUMN_ID, ALIGN_TRAIL, POSITION_INVISIBLE, 35, table_id);
    setRefreshInterval(INTERVAL_LIVE);
  }

  public void refresh(TableCell cell) {
    PEPeer peer = (PEPeer)cell.getDataSource();
    long value = (peer == null) ? 0 : peer.getUploadRateLimitBytesPerSecond();
    if (!cell.setSortValue(value) && cell.isValid())
      return;
   
    if(value == -1) {
      cell.setText(MessageText.getString("MyTorrents.items.UpSpeedLimit.disabled"));
View Full Code Here

    byte[] uploadingPieces = new byte[dm_pieces.length];

    // find upload pieces
    Iterator<PEPeer> peer_it = pm.getPeers().iterator();
    while( peer_it.hasNext()){
      PEPeer peer = peer_it.next();
      int[] peerRequestedPieces = peer.getIncomingRequestedPieceNumbers();
      if (peerRequestedPieces != null && peerRequestedPieces.length > 0) {
        int pieceNum = peerRequestedPieces[0];
        if(uploadingPieces[pieceNum] < 2)
          uploadingPieces[pieceNum] = 2;
        for (int j = 1; j < peerRequestedPieces.length; j++) {
View Full Code Here

    super(COLUMN_ID, ALIGN_CENTER, POSITION_INVISIBLE, 20, table_id);
    setRefreshInterval(INTERVAL_LIVE);
  }

  public void refresh(TableCell cell) {
    PEPeer peer = (PEPeer)cell.getDataSource();
    long value = (peer == null) ? 0 : (peer.isChokingMe() ? 1 : (peer.isUnchokeOverride()?2:0));

    if (!cell.setSortValue(value) && cell.isValid())
      return;

    cell.setText((value >0) ?(peer.isUnchokeOverride()?"+":"*") : "");
  }
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.core3.peer.PEPeer

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.