📄 bttorrent.java
字号:
/*
* @(#)BTTorrent.java ver 1.2 6/20/2005
*
* Copyright 2005 Weishuai Yang (wyang@cs.binghamton.edu).
* All rights reserved.
*
*/
package gps.protocol.BT.param;
import gps.protocol.BT.BTDocument;
import gps.protocol.BT.BTTracker;
/**
* Torrent class includes informations in the .torrent file.
*
* Torrent metainfo file includes the following keys:
*
* announce: the URL of the tracker
* name: file name
* piece length: block size
* pieces: hash of each piece
* length: file size
* path: file path
*
* In our simulation, only relavent information is included
*
* Note: hash of each piece is only for verification purpose!
* The torrent file and the corresponding document is indexed
* by the docHashKey
*
* @author Weishuai Yang
* @version 1.2, 6/20/2005
*/
public class BTTorrent {
/**
* reference to tracker where this torrent is stored at
*/
public BTTracker mTracker=null;
/**
* doc hash key
*/
public String mDocHashKey=null;
/**
* document length
*/
public double mLength=0;
/**
* piece length
*/
public double mPieceLength=0;
/**
* total piece number
*/
public int mPieceNum=0;
/**
* document popularity
*/
public int mPopularity=0;
/**
* constructs a BTTorrent object
* @param doc the document related to the torrent
* @param t tracker
*/
public BTTorrent(BTDocument doc, BTTracker t){
mTracker=t;
mDocHashKey=doc.getKey();
mLength=doc.getSize();
mPieceLength=doc.getPieceLength();
mPieceNum=doc.getPieceNum();
mPopularity=doc.getPopularity();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -