|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfiftyone.mobile.detection.Match
public class Match
Generate when a device detection is requested to include the signature matched, the confidence of the match and the method used to obtain the match.
| Nested Class Summary | |
|---|---|
(package private) class |
Match.MatchState
Used to persist the match results to the cache. |
private class |
Match.PossibleSignature
Used to represent a signature index and the number of times it occurs in the matched nodes. |
private class |
Match.PossibleSignatures
A custom linked list used to identify the most frequently occurring signature indexes. |
static interface |
Match.RankedSignatureIterator
Used to iterate over the closest signatures. |
| Field Summary | |
|---|---|
(package private) int |
closestSignaturesCount
|
private Dataset |
dataSet
The data set used for the detection. |
private Integer |
lowestScore
The current lowest score for the target user agent. |
MatchMethods |
method
|
int |
nextCharacterPositionIndex
The next character position to be checked. |
private static Comparator<Node> |
nodeComparator
Comparator used to order the nodes by length with the shortest first. |
private List<Node> |
nodes
List of nodes found for the match. |
(package private) int |
nodesEvaluated
|
(package private) Profile[] |
profiles
|
private Map<String,String[]> |
results
|
(package private) int |
rootNodesEvaluated
|
private Signature |
signature
|
private List<Signature> |
signatures
|
(package private) int |
signaturesCompared
|
(package private) int |
signaturesRead
|
(package private) int |
stringsRead
|
private String |
targetUserAgent
|
private byte[] |
targetUserAgentArray
|
| Constructor Summary | |
|---|---|
Match(Dataset dataSet)
Constructs a new detection match ready to be used. |
|
Match(Dataset dataSet,
String targetUserAgent)
Constructs a new detection match ready to be used to identify the profiles associated with the target user agent. |
|
| Method Summary | |
|---|---|
private Match.PossibleSignatures |
buildInitialList(int[] list)
|
void |
cleanTargetUserAgentArray()
Replaces any characters in the target user agent which are outside the range the dataset used when it was built with question marks. |
(package private) Match.RankedSignatureIterator |
getClosestSignatures()
Returns a distinct list of signatures which most closely match the target user agent string. |
int |
getClosestSignaturesCount()
The number of closest signatures returned for evaluation. |
private int |
getClosestSignaturesForNode(int[] signatureIndexList,
Match.PossibleSignatures linkedList,
int maxCount,
int iteration)
|
(package private) Dataset |
getDataSet()
|
String |
getDeviceId()
The unique id of the Device. |
int |
getDifference()
|
(package private) int |
getExactSignatureIndex()
|
(package private) int |
getIndexOf(Node node)
Returns the start character position of the node within the target user agent, or -1 if the node does not exist. |
Integer |
getLowestScore()
|
MatchMethods |
getMethod()
The method used to obtain the match. |
List<Node> |
getNodes()
|
int |
getNodesEvaluated()
The number of nodes checked. |
Profile[] |
getProfiles()
Array of profiles associated with the device that was found. |
Map<String,String[]> |
getResults()
|
int |
getRootNodesEvaluated()
The number of root nodes checked against the target user agent. |
Signature |
getSignature()
The signature with the closest match to the user agent provided. |
int |
getSignaturesCompared()
The number of signatures that were compared against the target user agent if the Closest match method was used. |
int |
getSignaturesRead()
The number of signatures read during the detection. |
int |
getStringsRead()
The number of strings that were read from the data structure for the match. |
String |
getTargetUserAgent()
The target user agent string used for the detection. |
byte[] |
getTargetUserAgentArray()
The user agent string as an ASCII byte array. |
String |
getUserAgent()
The user agent of the matching device with irrelevant characters removed. |
Values |
getValues(Property property)
Gets the values associated with the property name using the profiles found by the match. |
Values |
getValues(String propertyName)
Gets the values associated with the property name using the profiles found by the match. |
void |
incrNodesEvaluated()
|
void |
incrStringsRead()
|
private void |
init(String targetUserAgent)
Initialises the match object ready for detection. |
int |
insertNode(Node node)
Inserts the node into the list checking to find it's correct position in the list first. |
(package private) void |
reset(String targetUserAgent)
Resets the match for the user agent returning all the fields to the values they would have when the match was first constructed. |
(package private) void |
resetNextCharacterPositionIndex()
Reset the next character position index based on the length of the target user agent and the root nodes. |
void |
setLowestScore(Integer lowestScore)
|
(package private) void |
setSignature(Signature signature)
|
(package private) void |
setState(Match.MatchState state)
Sets the match properties based on the state information provided. |
String |
toString()
A string representation of the nodes found from the target user agent. |
void |
updateProfile(int profileId)
Override the profiles found by the match with the profileId provided. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final Comparator<Node> nodeComparator
private final List<Signature> signatures
private final List<Node> nodes
private final Dataset dataSet
public int nextCharacterPositionIndex
private byte[] targetUserAgentArray
private String targetUserAgent
private Signature signature
public MatchMethods method
int signaturesRead
int signaturesCompared
int rootNodesEvaluated
int nodesEvaluated
int stringsRead
int closestSignaturesCount
Profile[] profiles
private Integer lowestScore
private Map<String,String[]> results
| Constructor Detail |
|---|
public Match(Dataset dataSet)
dataSet -
public Match(Dataset dataSet,
String targetUserAgent)
throws UnsupportedEncodingException
dataSet - targetUserAgent -
UnsupportedEncodingException| Method Detail |
|---|
public byte[] getTargetUserAgentArray()
public String getTargetUserAgent()
public Signature getSignature()
void setSignature(Signature signature)
void reset(String targetUserAgent)
throws UnsupportedEncodingException
targetUserAgent -
UnsupportedEncodingExceptionvoid setState(Match.MatchState state)
state - of a previous match from the cache.
private void init(String targetUserAgent)
throws UnsupportedEncodingException
targetUserAgent -
UnsupportedEncodingExceptionpublic int getDifference()
public MatchMethods getMethod()
public int getSignaturesRead()
public int getSignaturesCompared()
public int getRootNodesEvaluated()
public int getNodesEvaluated()
public int getStringsRead()
public int getClosestSignaturesCount()
public String getDeviceId()
throws IOException
IOException
public Profile[] getProfiles()
throws IOException
IOExceptionpublic String getUserAgent()
void resetNextCharacterPositionIndex()
int getExactSignatureIndex()
throws IOException
IOException
Match.RankedSignatureIterator getClosestSignatures()
throws IOException
IOException
private int getClosestSignaturesForNode(int[] signatureIndexList,
Match.PossibleSignatures linkedList,
int maxCount,
int iteration)
private Match.PossibleSignatures buildInitialList(int[] list)
public List<Node> getNodes()
public Integer getLowestScore()
public void setLowestScore(Integer lowestScore)
public void incrStringsRead()
public void incrNodesEvaluated()
Dataset getDataSet()
public Values getValues(Property property)
throws IOException
property - The property whose values are required
IOException
public Values getValues(String propertyName)
throws IOException
propertyName - The property name whose values are required
IOException
public Map<String,String[]> getResults()
throws IOException
IOExceptionpublic void cleanTargetUserAgentArray()
int getIndexOf(Node node)
throws IOException
node -
IOException
public void updateProfile(int profileId)
throws IOException
profileId - The ID of the profile to replace the existing component
IOExceptionpublic String toString()
toString in class Objectpublic int insertNode(Node node)
node - The node to be added to the match list
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||