de.scheisseichfindemalkeinen.queue
Class Restriction

java.lang.Object
  extended by de.scheisseichfindemalkeinen.queue.Restriction
All Implemented Interfaces:
java.lang.Comparable<Restriction>

public class Restriction
extends java.lang.Object
implements java.lang.Comparable<Restriction>

This class is to set a limit of simultanious downloads for a domain. An example: The hostclass for rapidshare sets a restriction of one simultanious downloads when the hostclass is set to free-user. Because rapidshare does not allow more than one simultanious downloads for free-users. So when a rapidshare download is started, the counter is increased. Now if a other rapidshare downloads requested a slot, QueueData checks what the restriction for rapidshare is. Then it checks if there are already too many connections for rapidshare, and so it lets the next rapidshare download only start, when the one downloading at the moment has finished. One domain must be set, but it is possible to set multiple domains. So the restriction takes care of all domains set. The equals- and compareTo-methods take only care about the single domain or first domain in the vector! But the equals-method check the whole vector if a string should be compared.

See Also:
QueueCounter, QueueData

Constructor Summary
Restriction(java.lang.String domain, int maxSimultaneousDownloads)
          Constructor
Restriction(java.util.Vector<java.lang.String> domains, int maxSimultaneousDownloads)
          Constructor
 
Method Summary
 int compareTo(Restriction o)
           
 boolean equals(java.lang.Object obj)
           
 java.lang.String getDomain()
          Returns the domain
 java.util.Vector<java.lang.String> getDomains()
          Returns the domains
 int getMaxSimultaneousDownloads()
          Returns the maximum of simultanious downloads for this domain
 void setMaxSimultaneousDownloads(int maxSimultaneousDownloads)
          Sets the maximum of simultanious downloads for this domain
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Restriction

public Restriction(java.lang.String domain,
                   int maxSimultaneousDownloads)
Constructor

Parameters:
domain - Domain
maxSimultaneousDownloads - Maximum

Restriction

public Restriction(java.util.Vector<java.lang.String> domains,
                   int maxSimultaneousDownloads)
Constructor

Parameters:
domains - Domains
maxSimultaneousDownloads - Maximum
Method Detail

getDomain

public java.lang.String getDomain()
Returns the domain

Returns:
the name

getDomains

public java.util.Vector<java.lang.String> getDomains()
Returns the domains

Returns:
domains

getMaxSimultaneousDownloads

public int getMaxSimultaneousDownloads()
Returns the maximum of simultanious downloads for this domain

Returns:
Maximum

setMaxSimultaneousDownloads

public void setMaxSimultaneousDownloads(int maxSimultaneousDownloads)
Sets the maximum of simultanious downloads for this domain

Parameters:
maxSimultaneousDownloads - Maximum

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(Restriction o)
Specified by:
compareTo in interface java.lang.Comparable<Restriction>