|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfiftyone.mobile.detection.entities.BaseEntity
fiftyone.mobile.detection.entities.Node
public class Node
A node in the trie data structures held at each character position.
| Nested Class Summary | |
|---|---|
(package private) class |
Node.NodeNumericIndexIterator
|
| Field Summary | |
|---|---|
private byte[] |
characters
|
private int |
characterStringOffset
The offset in the strings data structure to the string that contains all the characters of the node. |
private NodeIndex[] |
children
A list of all the child node indexes. |
static int |
MIN_LENGTH
The minimum length of a node assuming no node indexes or signatures. |
short |
nextCharacterPosition
The next character position to the left of this node or a negative number if this is not a complete node. |
static int |
NODE_INDEX_LENGTH
The length of a node index. |
static int |
NODE_NUMERIC_INDEX_LENGTH
The length of a numeric node index. |
private NodeNumericIndex[] |
numericChildren
An array of all the numeric children. |
private Node |
parent
|
(package private) int |
parentIndex
The parent index for this node. |
short |
position
The position of the first character the node represents in the signature or target user agent. |
private static Range[] |
ranges
|
private Node |
root
|
private int[] |
signatureIndexes
A list of all the signature indexes that relate to this node. |
| Constructor Summary | |
|---|---|
Node(Dataset dataSet,
int offset,
BinaryReader reader)
Constructs a new instance of Node |
|
| Method Summary | |
|---|---|
void |
addCharacters(byte[] values)
Adds the characters for this node to the values array. |
int |
compareTo(Node other)
Compares one node to another for the purposes of determining the signature the node relates to. |
byte[] |
getCharacters()
Gets an array containing all the characters of the node. |
int |
getChildrenLength()
|
Node |
getCompleteNode(Match match)
Returns a complete node for the match object provided. |
Node |
getCompleteNumericNode(Match match)
|
private Integer |
getCurrentPositionAsNumeric(Match match)
Returns the node position as a number. |
boolean |
getIsOverlap(Match match)
Returns true if any of the nodes in the match have overlapping characters with this one. |
private boolean |
getIsOverlap(Node node)
Returns true if the node overlaps with this one. |
int |
getLength()
Returns the number of characters in the node tree. |
(package private) Node |
getNextNode(Match match)
Returns the next node for the characters provided from the start index for the number of characters specified. |
private Integer |
getNumber(byte[] array,
int start,
int length)
Returns an integer representation of the characters between start and end. |
int |
getNumericChildrenLength()
|
private Node.NodeNumericIndexIterator |
getNumericNodeIterator(int target)
Provides an iterator which provides the closest numeric children to the target is ascending order of difference |
(package private) Node |
getParent()
Returns the parent node for this node. |
private Range |
getRange(int target)
Determines the range the target value falls between |
int[] |
getRankedSignatureIndexes()
|
Node |
getRoot()
Returns the root node for this node. |
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. |
(package private) boolean |
isComplete()
Returns true if this node represents a completed sub string and the next character position is set. |
private static NodeIndex[] |
readNodeIndexes(Dataset dataSet,
BinaryReader reader,
int offset,
short count)
Used by the constructor to read the variable length list of child node indexes associated with the node. |
private static NodeNumericIndex[] |
readNodeNumericIndexes(Dataset dataSet,
BinaryReader reader,
short count)
Used by the constructor to read the variable length list of child node numeric indexes associated with the node. |
String |
toString()
Returns a string of spaces with the characters relating to this node populated. |
| 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 |
|---|
public static final int NODE_INDEX_LENGTH
public static final int NODE_NUMERIC_INDEX_LENGTH
public static final int MIN_LENGTH
private static final Range[] ranges
private final int[] signatureIndexes
private final NodeIndex[] children
private final NodeNumericIndex[] numericChildren
final int parentIndex
private final int characterStringOffset
public final short nextCharacterPosition
public final short position
private Node root
private Node parent
private byte[] characters
| Constructor Detail |
|---|
public Node(Dataset dataSet,
int offset,
BinaryReader reader)
dataSet - The data set the node is contained withinoffset - The offset in the data structure to the node| Method Detail |
|---|
public Node getRoot()
throws IOException
IOException
Node getParent()
throws IOException
IOExceptionboolean isComplete()
public int getLength()
throws IOException
IOException
public byte[] getCharacters()
throws IOException
IOExceptionpublic int[] getRankedSignatureIndexes()
public int getChildrenLength()
public int getNumericChildrenLength()
private static NodeNumericIndex[] readNodeNumericIndexes(Dataset dataSet,
BinaryReader reader,
short count)
dataSet - The data set the node is contained withinreader - Reader connected to the source data structure and
positioned to start readingcount - The number of elements to read into the array
private static NodeIndex[] readNodeIndexes(Dataset dataSet,
BinaryReader reader,
int offset,
short count)
dataSet - The data set the node is contained withinreader - Reader connected to the source data structure and
positioned to start readingoffset - The offset in the data structure to the nodecount - The number of elements to read into the array
public void init()
throws IOException
IOException
public Node getCompleteNumericNode(Match match)
throws IOException
IOExceptionprivate Node.NodeNumericIndexIterator getNumericNodeIterator(int target)
target - value of the sub string in the user agent
private Range getRange(int target)
target - value whose range is required
private Integer getCurrentPositionAsNumeric(Match match)
match - results including the target user agent
private Integer getNumber(byte[] array,
int start,
int length)
array - Array of characters with numeric characters present between
start and endstart - The first character to use to convert to a numberlength - The number of characters to use in the conversion
public Node getCompleteNode(Match match)
throws IOException
match - results including the target user agent
IOException
Node getNextNode(Match match)
throws IOException
match - Match results including the target user agent
IOException
private boolean getIsOverlap(Node node)
throws IOException
node -
IOException
public boolean getIsOverlap(Match match)
throws IOException
match -
IOException
public void addCharacters(byte[] values)
throws IOException
values -
IOExceptionpublic String toString()
toString in class Objectpublic int compareTo(Node other)
compareTo in interface Comparable<Node>other - node to be compared
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||