public class Controller extends Object
The process uses 3 steps to determine the properties associated with the provided user agent.
Step 1 - each of the character positions of the target user agent are checked from right to left to determine if a complete node or sub string is present at that position. For example; the sub string Chrome/11 might indicate the user agent relates to Chrome version 11 from Google. Once every character position is checked a list of matching nodes will be available.
Step 2 - The list of signatures is then searched to determine if the matching nodes relate exactly to an existing signature. Any popular device will be found at this point. The approach is exceptionally fast at identifying popular devices.
Step 3 - If the target user agent is less popular, or newer than the creation time of the data set, a small sub set of possible signatures are identified from the matching nodes. These signatures are evaluated against the target user agent to determine the different in relevant characters between them. The signature which has the lowest difference and is most popular is then returned.
Random user agents will not identify any matching nodes. In these situations a default signature is returned.
The characteristics of the detection data set will determine the accuracy of the result match. Older data sets that are unaware of the latest devices, or user agent formats in use will be less accurate.
For more information see http://51degrees.mobi/Support/Documentation/Java
| Modifier and Type | Field and Description |
|---|---|
private static ClosestScore |
closest
Used to calculate closest scores between the match and the user agent.
|
private static NearestScore |
nearest
Used to calculate nearest scores between the match and the user agent.
|
| Constructor and Description |
|---|
Controller() |
| Modifier and Type | Method and Description |
|---|---|
private void |
evaluate(Match match)
Evaluates the match at the current character position until there are no
more characters left to evaluate.
|
private void |
evaluateNumeric(Match match) |
void |
match(Match match)
Entry point to the detection process.
|
private void |
matchDefault(Match match)
The detection failed and a default match needs to be returned.
|
private static final NearestScore nearest
private static final ClosestScore closest
public void match(Match match) throws IOException
The dataSet may be used by other threads in parallel and is not assumed to be used by only one detection process at a time.
The memory implementation of the data set will always perform fastest but does consume more memory.
match - The match object to be updated.IOExceptionprivate void evaluateNumeric(Match match) throws IOException
IOExceptionprivate void matchDefault(Match match) throws IOException
match - Information about the detectionIOExceptionprivate void evaluate(Match match) throws IOException
match - Information about the detectionIOException