AzureusSegment.java
| Index Score | ||
|---|---|---|
![]() |
![]() |
org.xnap.plugin.azureus |
![]() |
![]() |
XNap 3 |
View: Reasons, Metrics, Source Code
These are the metrics that contribute to the Enerjy Score for this file, ranked by impact. So the metrics listed at the top influence the score to a greater extent that the metrics listed at the bottom.
| Metric | Description | |
|---|---|---|
/*
* XNap - A P2P framework and client.
*
* See the file AUTHORS for copyright information.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.xnap.plugin.azureus;
import org.gudy.azureus2.core3.peer.PEPeerManager;
import org.gudy.azureus2.core3.peer.PEPiece;
import org.gudy.azureus2.plugins.peers.PeerManager;
import org.xnap.transfer.Segment;
/**
* <p>The end of the segment can change through a split.
*/
public class AzureusSegment implements Segment {
//--- Constant(s) ---
/**
* The minimun size for a single segment.
*/
public static final long MIN_SEGEMENT_SIZE = 100 * 1024;
//--- Data Field(s) ---
private AzureusDownloadContainer parent;
private PEPiece piece;
//--- Constructor(s) ---
public AzureusSegment(AzureusDownloadContainer parent, PEPiece piece)
{
this.parent = parent;
this.piece = piece;
}
public int getAvailability()
{
return 128;
}
/**
* @see org.xnap.transfer.Segment#getEnd()
*/
public long getEnd()
{
return piece.getLength();
}
/**
* @see org.xnap.transfer.Segment#getStart()
*/
public long getStart()
{
return piece.getPieceNumber() * PEPeerManager.BLOCK_SIZE;
}
/**
* @see org.xnap.transfer.Segment#getTotal()
*/
public long getTotal()
{
return parent.getFilesize();
}
/**
* @see org.xnap.transfer.Segment#getTransferred()
*/
public long getTransferred()
{
return piece.getCompleted() * PEPeerManager.BLOCK_SIZE;
}
//--- Methods ---
}
The table below shows all metrics for AzureusSegment.java.
| Metric | Value | Description | |
|---|---|---|---|



