public class Comparison extends Object
As standard the Hash provider is available by uncommenting the code starting at the FiftyOneDegreesHashTrieProvider method and then adding the compiled Hash JAR as a dependency which can be found here.
You can build a new version of the dependency by cloning this repository and following these steps:
NOTE: SWIG and and Maven are required to compile a new JAR dependency
git clone https://github.com/51Degrees/Device-Detection
cd Device-Detection/java/
build.sh (build.bat for Windows)
cd trie
mvn install
Add the compiled JAR file to your project and ensure you add a reference to your Hash Trie data file when you run the comparison.
Compares multiple device detection methods for accuracy and performance outputting a single CSV file where each row contains the results from one or more solutions for each of the target User-Agents provided.
| Provider | Browscap | 51Degrees |
|---|---|---|
| Time to initialise provider (ms) | 7,571.2 | 311.4 |
| Average time per detection per thread (ms) | 0.0137752 | 0.0108086 |
Browscap, or Browser Capabilities project , is an open source project which maintains and offers free downloads of a browscap.ini file, a browser capabilities database. It is a list of all known browsers and bots, along with their default capabilities and limitations.
This example implements the Blueconic java library which is available on GitHub and Maven.
Note: the implementations for WURFL and DeviceAtlas has not been tested by the original author as 51Degrees do not have access to the associated source code or data files. They have been generated theoretically from the associated API documentation provided but are intended to be easy to modify. The code marked "UNCOMMENT" will need to be uncommented and the associated packages and data files obtained from ScientiaMobile and / or DeviceAtlas to enable the associated providers.
| Constructor and Description |
|---|
Comparison() |
| Modifier and Type | Method and Description |
|---|---|
double |
getAverageDetectionTimePerThread() |
int |
getCount() |
static void |
main(String[] args)
Instantiates this class and starts
runComparisons(String, String, String, String, String, String, int)
with parameters from the command line. |
void |
run(fiftyone.device.example.illustration.Comparison.ComparisonProvider provider,
LinkedList<fiftyone.device.example.illustration.Comparison.Request> requests,
int numberOfThreads) |
public double getAverageDetectionTimePerThread()
public int getCount()
public void run(fiftyone.device.example.illustration.Comparison.ComparisonProvider provider,
LinkedList<fiftyone.device.example.illustration.Comparison.Request> requests,
int numberOfThreads)
throws IOException,
InterruptedException
IOExceptionInterruptedExceptionpublic static void main(String[] args) throws IOException, InterruptedException
runComparisons(String, String, String, String, String, String, int)
with parameters from the command line. When run from the command line
the first and last file arguments must be a file of User-Agents and the
file that the comparison results will be written to. Files between the
first and last file are optional and provide the FiftyOneDegrees,
WURFL and DeviceAtlas data files. A final optional argument of type
integer can be provided to determine the number of concurrent threads
to use during processing if the provider supports multi threaded
operation.args - command line arguments.IOExceptionInterruptedExceptionCopyright © 2018 51Degrees. All rights reserved.