fiftyone.mobile.detection.entities
Class Signature

java.lang.Object
  extended by fiftyone.mobile.detection.entities.BaseEntity
      extended by fiftyone.mobile.detection.entities.Signature
All Implemented Interfaces:
Comparable<Signature>

public class Signature
extends BaseEntity
implements Comparable<Signature>

The relevant characters from a user agent structured in a manner to enable rapid comparison with a target user agent.


Field Summary
private  int _length
           
private  String deviceId
           
 int[] nodeOffsets
          List of the node indexes the signature relates to ordered by index of the node.
private  int[] profileOffsets
           
private  Profile[] profiles
           
private  String stringValue
           
private  Value[] values
           
 
Constructor Summary
Signature(Dataset dataSet, int index, BinaryReader reader)
          Constructs a new instance of Signature
 
Method Summary
 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.
 String getDeviceId()
          The unique Device Id for the signature.
 int getLength()
          The length in bytes of the signature.
 Profile[] getProfiles()
          List of the profiles the signature relates to.
private  Profile[] getProfiles(int[] profileIndexes)
          Returns an array of profiles associated with the signature.
 SortedList<String,List<String>> getPropertyValuesAsStrings()
          Gets a string list of the properties and names.
private  int getSignatureLength()
           
 Value[] getValues()
           
 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.
private  String initGetDeviceId()
           
private  Value[] initGetValues()
          Returns an array of values associated with the signature.
private  int[] ReadOffsets(Dataset dataSet, BinaryReader reader, int length)
          Uses the offsets list which must be locked to read in the arrays of nodes or profiles that relate to the signature.
 String toString()
          String representation of the signature where irrelevant characters are removed.
 
Methods inherited from class fiftyone.mobile.detection.entities.BaseEntity
binarySearch, getDataSet, getIndex, readIntegerArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nodeOffsets

public final int[] nodeOffsets
List of the node indexes the signature relates to ordered by index of the node.


profileOffsets

private int[] profileOffsets

profiles

private Profile[] profiles

deviceId

private String deviceId

values

private Value[] values

_length

private int _length

stringValue

private String stringValue
Constructor Detail

Signature

public Signature(Dataset dataSet,
                 int index,
                 BinaryReader reader)
Constructs a new instance of Signature

Parameters:
dataSet - The data set the node is contained within
index - The index in the data structure to the node
reader - Reader connected to the source data structure and positioned to start reading
Method Detail

getProfiles

public Profile[] getProfiles()
                      throws IOException
List of the profiles the signature relates to.

Throws:
IOException

getDeviceId

public String getDeviceId()
                   throws IOException
The unique Device Id for the signature.

Throws:
IOException

getValues

public Value[] getValues()
                  throws IOException
Throws:
IOException

getLength

public int getLength()
              throws IOException
The length in bytes of the signature.

Throws:
IOException

getSignatureLength

private int getSignatureLength()
                        throws IOException
Returns:
the number of characters in the signature.
Throws:
IOException

ReadOffsets

private int[] ReadOffsets(Dataset dataSet,
                          BinaryReader reader,
                          int length)
Uses the offsets list which must be locked to read in the arrays of nodes or profiles that relate to the signature.

Parameters:
dataSet - The data set the node is contained within
reader - Reader connected to the source data structure and positioned to start reading
length - The number of offsets to read in
Returns:
An array of the offsets as integers read from the reader

init

public void init()
          throws IOException
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.

Throws:
IOException

initGetDeviceId

private String initGetDeviceId()
                        throws IOException
Throws:
IOException

getPropertyValuesAsStrings

public SortedList<String,List<String>> getPropertyValuesAsStrings()
                                                           throws IOException
Gets a string list of the properties and names.

Returns:
dictionary of properties and values for the signature
Throws:
IOException

initGetValues

private Value[] initGetValues()
                       throws IOException
Returns an array of values associated with the signature.

Returns:
Throws:
IOException

getProfiles

private Profile[] getProfiles(int[] profileIndexes)
                       throws IOException
Returns an array of profiles associated with the signature.

Parameters:
profileIndexes -
Returns:
Throws:
IOException

compareTo

public int compareTo(List<Node> nodes)
Compares this signature to a list of node offsets.

Parameters:
nodeOffsets - The node indexes to be compared against
Returns:
Indication of relative value based on the node offsets

compareTo

public int compareTo(Signature other)
Compares this signature to another based on the node offsets. The node offsets in both signatures must be in ascending order.

Specified by:
compareTo in interface Comparable<Signature>
Parameters:
other - The signature to be compared against
Returns:
Indication of relative value based based on node offsets

toString

public String toString()
String representation of the signature where irrelevant characters are removed.

Overrides:
toString in class Object
Returns:
The signature as a string