public abstract class Signature extends BaseEntity implements Comparable<Signature>
A signature contains those characters of a User-Agent which are relevant for the purposes of device detection. For example: most User-Agents will start with "Mozilla" and therefore these characters are of very little use when detecting devices. Other characters such as those that represent the model of the hardware are very relevant.
A signature contains both an array of relevant characters from User-Agents identified when the data was created and the unique complete node identifies of relevant sub strings contained in multiple signatures and User-Agents. Together this information is used at detection time to rapidly identify the signature matching a target User-Agent.
Signatures relate to device properties via
profiles. Each signature relates to one profile for each
Component type.
Unlike other entities the signature may have a varying number of nodes and profiles associated with it depending on the data set. All signatures within a data set will have the same number of profiles and nodes associated with them all. As these can change across data sets they can't be included in the source code.
Objects of this class should not be created directly as they are part of the
internal logic. Use the relevant Dataset method to access these
objects.
For more information see: 51Degrees pattern data model.
| Modifier and Type | Class and Description |
|---|---|
class |
Signature.ValueIterator
Provides a way to iterate over the values of a provided signature.
|
dataSet, index| Constructor and Description |
|---|
Signature(Dataset dataSet,
int index,
BinaryReader reader)
Constructs a new instance of Signature.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(List<Node> nodes)
Compares this signature to a list of node offsets.
|
int |
compareTo(Signature other)
Compares this signature to another based on the node offsets.
|
protected Node[] |
doGetNodes() |
String |
getDeviceId()
The unique Device Id for the signature.
|
int |
getLength()
The length in bytes of the signature.
|
abstract List<Integer> |
getNodeOffsets()
Array of node offsets associated with the signature.
|
Node[] |
getNodes()
An array of nodes associated with the signature.
|
Profile[] |
getProfiles()
List of the profiles the signature relates to.
|
SortedList<String,List<String>> |
getPropertyValuesAsStrings()
Gets a string list of the properties and names.
|
abstract int |
getRank()
Gets the rank, where a lower number means the signature is more popular,
of the signature compared to other signatures.
|
protected abstract int |
getSignatureLength()
The number of characters in the signature.
|
Iterator<Value> |
getValues() |
Values |
getValues(Property property)
Gets the values associated with the property.
|
Values |
getValues(String propertyName)
Gets the values associated with the property name.
|
void |
init()
Called after the entire data set has been loaded to ensure any further
initialisation steps that require other items in the data set can be
completed.
|
protected static List<Integer> |
readPositiveAndZeroIntegers(BinaryReader reader,
int count)
Populates the list provided with the positive values upto the number of
items defined by count.
|
String |
toString()
String representation of the signature where irrelevant characters are
removed.
|
compareTo, compareTo, getDataSet, getIndex, getIsNumeric, getNumber, readIntegerArray, readIntegerListpublic Signature(Dataset dataSet, int index, BinaryReader reader)
dataSet - the Dataset the signature is contained within.index - the index in the data structure to the signature.reader - BinaryReader connected to the source data structure and
positioned to start reading.public Profile[] getProfiles() throws IOException
profiles the signature relates to.IOException - if there was a problem accessing data file.public String getDeviceId() throws IOException
Profile IDs, one per each Component.IOException - if there was a problem accessing data file.public Values getValues(Property property) throws IOException
property - the Property whose values are requiredValues associated with the property, or null if the
property does not exist.IOException - if there was a problem accessing data file.public Values getValues(String propertyName) throws IOException
propertyName - name of the Property whose values are
required.Values associated with the property, or null if the
property does not exist.IOException - if there was a problem accessing data file.public Iterator<Value> getValues() throws IOException
values associated with this
signature.IOException - if there was a problem accessing data file.public int getLength()
throws IOException
IOException - if there was a problem accessing data file.protected Node[] doGetNodes() throws IOException
IOException - if there was a problem accessing data file.public Node[] getNodes() throws IOException
IOException - if there was a problem accessing data file.protected static List<Integer> readPositiveAndZeroIntegers(BinaryReader reader, int count)
reader - Reader connected to the source data structure and
positioned to start readingcount - The number of offsets to read inpublic void init()
throws IOException
Do not reference this method directly as it is part of the internal logic.
IOException - if there was a problem accessing data file.public SortedList<String,List<String>> getPropertyValuesAsStrings() throws IOException
IOException - if there was a problem accessing data file.public int compareTo(List<Node> nodes) throws IOException
nodes - list of nodes to compare to.IOException - if there was a problem accessing data file.public int compareTo(Signature other)
compareTo in interface Comparable<Signature>other - The signature to be compared against.public String toString()
This method should not be called as it is part of the internal logic.
public abstract List<Integer> getNodeOffsets() throws IOException
IOException - if there was a problem accessing data file.protected abstract int getSignatureLength()
throws IOException
IOException - if there was a problem accessing data file.public abstract int getRank()
throws IOException
IOException - if there was a problem accessing data file.Copyright © 2017 51Degrees. All rights reserved.