Package com.biglybt.ui.console.commands
Class TorrentFilter
- java.lang.Object
-
- com.biglybt.ui.console.commands.TorrentFilter
-
public class TorrentFilter extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.regex.Pattern
rangePattern
-
Constructor Summary
Constructors Constructor Description TorrentFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List
getTorrents(java.util.List torrentsToMatch, java.lang.String filter)
tries our two different matching algorithms using the supplied filter against the list of torrents in the ConsoleInput objectjava.util.List
getTorrents(java.util.List torrentsToMatch, java.util.List args)
first tries to match torrents by concatenating all of the arguments.private java.util.List
matchRange(java.util.List torrents, java.lang.String filter)
matches a range of torrents.private java.util.List
matchWildcard(java.util.List torrents, java.lang.String filter)
attempst to match a wildcard against the list of torrents by checking their display nameprivate java.lang.String
wildcardToPattern(java.lang.String wild)
converts the wildcard (eg: tran*) into a regular expression - (tran.*)
-
-
-
Method Detail
-
matchRange
private java.util.List matchRange(java.util.List torrents, java.lang.String filter)
matches a range of torrents. eg: 3-5 or a single torrent. eg: 3. or from 3 onwards: 3-- Parameters:
torrents
- torrents to matchfilter
- range expression- Returns:
- list of matched DownloadManager objects
-
matchWildcard
private java.util.List matchWildcard(java.util.List torrents, java.lang.String filter)
attempst to match a wildcard against the list of torrents by checking their display name- Parameters:
torrents
- list of available torrents to matchfilter
- wildcard (glob) filter- Returns:
- list of matched DownloadManager objects
-
wildcardToPattern
private java.lang.String wildcardToPattern(java.lang.String wild)
converts the wildcard (eg: tran*) into a regular expression - (tran.*)- Parameters:
wild
- wildcard (glob) expression- Returns:
- regular expression string
-
getTorrents
public java.util.List getTorrents(java.util.List torrentsToMatch, java.lang.String filter)
tries our two different matching algorithms using the supplied filter against the list of torrents in the ConsoleInput object- Parameters:
torrentsToMatch
- list of DownloadManager objects to attempt to match againstfilter
- filter - eg: range or glob filter- Returns:
- list of matched DownloadManager objects
-
getTorrents
public java.util.List getTorrents(java.util.List torrentsToMatch, java.util.List args)
first tries to match torrents by concatenating all of the arguments. if that doesn't work, attempts to match each argument individually.- Parameters:
torrentsToMatch
- list of DownloadManager objects to attempt to match againstargs
- arguments to try to match- Returns:
- list of matched DownloadManager objects
-
-