|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfiftyone.mobile.detection.Controller
public class Controller
A single static class which controls the device detection process.
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
| Field Summary | |
|---|---|
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 Summary | |
|---|---|
Controller()
|
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final NearestScore nearest
private static final ClosestScore closest
| Constructor Detail |
|---|
public Controller()
| Method Detail |
|---|
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.
IOException
private void evaluateNumeric(Match match)
throws IOException
IOException
private void matchDefault(Match match)
throws IOException
match - Information about the detection
IOException
private void evaluate(Match match)
throws IOException
match - Information about the detection
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||