View Javadoc

1   /*
2    *  XNap - A P2P framework and client.
3    *
4    *  See the file AUTHORS for copyright information.
5    *
6    *  This program is free software; you can redistribute it and/or modify
7    *  it under the terms of the GNU General Public License as published by
8    *  the Free Software Foundation.
9    *
10   *  This program is distributed in the hope that it will be useful,
11   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   *  GNU General Public License for more details.
14   *
15   *  You should have received a copy of the GNU General Public License
16   *  along with this program; if not, write to the Free Software
17   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18   */
19  
20  package org.xnap.plugin.azureus;
21  
22  import org.xnap.transfer.Segment;
23  
24  /***
25   * 
26   */
27  public class AzureusDownloadSegment implements Segment {
28  
29  	//--- Constant(s) ---
30  
31  	private long start;
32  	private long end;
33  	private long totalSize;
34  	
35  	//--- Data Field(s) ---
36  
37  	private Segment parentSegment;
38  	
39      //--- Constructor(s) ---
40  
41      public AzureusDownloadSegment(long totalSize, long start, long end, Segment parentSegment) 
42      {
43      	this.totalSize = totalSize;
44      	this.start = start;
45      	this.end = end;
46      	this.parentSegment = parentSegment;
47      }
48  
49  	public int getAvailability()
50  	{
51  		return parentSegment.getAvailability();
52  	}
53  
54  	/***
55  	 *  @see org.xnap.transfer.Segment#getEnd()
56  	 */
57  	public long getEnd() 
58  	{
59  		return end;
60  	}
61  
62  	/***
63  	 *  @see org.xnap.transfer.Segment#getStart()
64  	 */
65  	public long getStart() 
66  	{
67  		return start;
68  	}
69  
70  	/***
71  	 *  @see org.xnap.transfer.Segment#getTotal()
72  	 */
73  	public long getTotal() 
74  	{
75  		return totalSize;
76  	}
77  
78  	/***
79  	 *  @see org.xnap.transfer.Segment#getTransferred()
80  	 */
81  	public long getTransferred() 
82  	{
83  		return parentSegment.getTransferred();
84  	}
85  
86      //--- Methods ---
87  
88  }