2 * jFCPlib-high-level-client - HighLevelContinuosResult.java -
3 * Copyright © 2008 David Roden
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
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.
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.
20 package net.pterodactylus.fcp.highlevel;
23 * Result for operations that send progress messages until they have completed.
25 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
28 public abstract class HighLevelContinuousResult extends HighLevelResult {
30 /** The number of total blocks. */
31 private int totalBlocks;
33 /** The number of required blocks. */
34 private int requiredBlocks;
36 /** The number of successfully transferred blocks. */
37 private int successfulBlocks;
39 /** The number of failed blocks. */
40 private int failedBlocks;
42 /** The number of fatally failed blocks. */
43 private int fatallyFailedBlocks;
45 /** Whether the total number is finalized. */
46 private boolean totalFinalized;
49 * Returns the number of total blocks.
51 * @return The number of total blocks
53 public int getTotalBlocks() {
58 * Sets the number of total blocks.
61 * The number of total blocks
63 void setTotalBlocks(int totalBlocks) {
64 this.totalBlocks = totalBlocks;
68 * Returns the number of required blocks. For downloads, this number is
69 * smaller than {@link #getTotalBlocks()}.
71 * @return The number of required blocks
73 public int getRequiredBlocks() {
74 return requiredBlocks;
78 * Sets the number of required blocks.
80 * @param requiredBlocks
81 * The number of required blocks
83 void setRequiredBlocks(int requiredBlocks) {
84 this.requiredBlocks = requiredBlocks;
88 * Returns the number of successfully transferred blocks.
90 * @return The number of successfully transferred blocks
92 public int getSuccessfulBlocks() {
93 return successfulBlocks;
97 * Sets the number of successfully transferred blocks.
99 * @param successfulBlocks
100 * The number of successfully transferred blocks
102 void setSuccessfulBlocks(int successfulBlocks) {
103 this.successfulBlocks = successfulBlocks;
107 * Returns the number of failed blocks. Blocks that have failed can be
110 * @return The number of failed blocks
112 public int getFailedBlocks() {
117 * Sets the number of failed blocks.
119 * @param failedBlocks
120 * The number of failed blocks
122 void setFailedBlocks(int failedBlocks) {
123 this.failedBlocks = failedBlocks;
127 * Returns the number of fatally failed blocks. Fatally failed blocks will
128 * never complete, even with endless retries.
130 * @return The number of fatally failed blocks
132 public int getFatallyFailedBlocks() {
133 return fatallyFailedBlocks;
137 * Sets the number of fatally failed blocks.
139 * @param fatallyFailedBlocks
140 * The number fatally failed blocks
142 void setFatallyFailedBlocks(int fatallyFailedBlocks) {
143 this.fatallyFailedBlocks = fatallyFailedBlocks;
147 * Returns whether the result of {@link #getTotalBlocks()} is final, i.e. it
148 * won’t change anymore.
150 * @return <code>true</code> if the result of {@link #getTotalBlocks()} is
151 * final, <code>false</code> otherwise
153 public boolean isTotalFinalized() {
154 return totalFinalized;
158 * Sets whether the result of {@link #getTotalBlocks()} is final, i.e. it
159 * won’t change anymore.
161 * @param totalFinalized
162 * <code>true</code> if the result of {@link #getTotalBlocks()}
163 * is final, <code>false</code> otherwise
165 void setTotalFinalized(boolean totalFinalized) {
166 this.totalFinalized = totalFinalized;