summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/imagemaster/serverconnection/DownloadingClient.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/openslx/imagemaster/serverconnection/DownloadingClient.java')
-rw-r--r--src/main/java/org/openslx/imagemaster/serverconnection/DownloadingClient.java71
1 files changed, 0 insertions, 71 deletions
diff --git a/src/main/java/org/openslx/imagemaster/serverconnection/DownloadingClient.java b/src/main/java/org/openslx/imagemaster/serverconnection/DownloadingClient.java
deleted file mode 100644
index 630096f..0000000
--- a/src/main/java/org/openslx/imagemaster/serverconnection/DownloadingClient.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.openslx.imagemaster.serverconnection;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Helper class for the ImageProcessor and ConnectionHandler to know some things about the downloading client
- */
-public class DownloadingClient
-{
-
- private final HashMap<String, ImageInfos> downloadingImages = new HashMap<>();
-
- public void addDownload( String uuid, List<Integer> list, String token )
- {
- downloadingImages.put( uuid, new ImageInfos( uuid, list, token ) );
- }
-
- public void removeDownload( String uuid )
- {
- downloadingImages.remove( uuid );
- }
-
- public boolean isDownloading( String uuid )
- {
- return downloadingImages.containsKey( uuid );
- }
-
- public boolean hasDownloads()
- {
- return (downloadingImages.size() > 0);
- }
-
- public List<Integer> getLastRequestedBlocks( String token )
- {
- for (Map.Entry<String, ImageInfos> entry : downloadingImages.entrySet() ) {
- if (entry.getValue().token.equals( token )) return entry.getValue().lastRequestedBlocks;
- }
- return null;
- }
-
- public void requestBlocks( String uuid, List<Integer> list )
- {
- if ( !downloadingImages.containsKey( uuid ) )
- return;
- downloadingImages.get( uuid ).lastRequestedBlocks = list;
- }
-
- public String getToken( String uuid )
- {
- if ( !downloadingImages.containsKey( uuid ) )
- return null;
- return downloadingImages.get( uuid ).token;
- }
-
- class ImageInfos
- {
- public final String uuid;
- public final String token;
- private List<Integer> lastRequestedBlocks;
-
- ImageInfos(String uuid, List<Integer> list, String token)
- {
- this.uuid = uuid;
- this.lastRequestedBlocks = list;
- this.token = token;
- }
- }
-
-}