1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.transfer;
21
22 import org.xnap.peer.*;
23
24 /***
25 * Defines the requirements for classes that can be queued.
26 *
27 * @see TransferQueue
28 */
29 public interface Queueable {
30
31 /***
32 * Returns the time when the queueable was enqueued in milli seconds.
33 */
34 long getEnqueueTime();
35
36 /***
37 * @see Transfer#getFilename()
38 */
39 String getFilename();
40
41 /***
42 * @see Transfer#getFilesize()
43 */
44 long getFilesize();
45
46 /***
47 * @see Transfer#getPeer()
48 */
49 Peer getPeer();
50
51 /***
52 * Basically a boost factor. Higher values will yield better queue
53 * positions.
54 */
55 int getPriority();
56
57 /***
58 * Returns the position in the queue.
59 */
60 int getQueuePosition();
61
62 /***
63 * Invoked by the queue to update the position.
64 *
65 * @param position if 0, the item has been dequeued from the
66 * queue and startQueued() has been called.
67 */
68 void setQueuePosition(int position);
69
70 /***
71 * Invoked by queue once the item moves to the top of the queue and is
72 * ready to run.
73 *
74 * @return true, if item has accepted the running state and should be
75 * dequeued; false, if item wants to remain queued
76 */
77 boolean startTransfer();
78
79 }