Package org.eclipse.lemminx.extensions.references.search

## Class SearchNode

- java.lang.Object
- - org.eclipse.lemminx.extensions.references.search.SearchNode

All Implemented Interfaces:
  `DOMRange`

    public class SearchNode
    extends Object
    implements DOMRange

Search node wraps a DOM node which matches a from/to path of a given `XMLReferenceExpression`.

If the expression doesn't define multiple `XMLReferenceExpression.isMultiple()` the search node contains the same ranges (start / end offsets) and the same value than the DOM node. Ex : `` In this sample the DOM node will generate one search node with the following range: ``

If the expression defines multiple `XMLReferenceExpression.isMultiple()` the DOM node generates several search node with proper ranges and value. Ex : `` In this sample the DOM node will generate two search nodes with the following ranges: ``

Author:
  Angelo ZERR

### Nested Class Summary

Nested Classes
`static class` `SearchNode.Direction`
`static class` `SearchNode.ValidationStatus`

### Constructor Summary

Constructors
`SearchNode​(int start, int end, DOMNode node, String prefix, SearchNode.Direction direction)`

### Method Summary

All Methods Instance Methods Concrete Methods
`org.eclipse.lsp4j.Range` `createRange()`
`org.eclipse.lsp4j.Range` `createRange​(boolean checkPrefix)`
`SearchNode.Direction` `getDirection()`
`int` `getEnd()` Returns the end offset of the node.
`DOMNode` `getNode()`
`DOMDocument` `getOwnerDocument()` Returns the owner document.
`String` `getPrefix()`
`int` `getStart()` Returns the start offset of the node.
`SearchNode.ValidationStatus` `getValidationStatus()` Returns the validation status of the search node.
`String` `getValue​(String forcedPrefix)`
`boolean` `isNeedToAjdustWithPrefix()`
`boolean` `isValid()` Returns true if the search node is valid and false otherwise.
`boolean` `matchesValue​(SearchNode searchNode)` Returns true if the given search node `searchNode` matches the value of this search node and false otherwise.
`String` `toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### SearchNode

    public SearchNode​(int start,
                      int end,
                      DOMNode node,
                      String prefix,
                      SearchNode.Direction direction)

### Method Detail

#### getValue

    public String getValue​(String forcedPrefix)

#### getPrefix

    public String getPrefix()

#### matchesValue

    public boolean matchesValue​(SearchNode searchNode)

Returns true if the given search node `searchNode` matches the value of this search node and false otherwise.

Parameters:
  `searchNode` - the search node.
Returns:
  true if the given search node `searchNode` matches the value of this search node and false otherwise.

#### getNode

    public DOMNode getNode()

#### getStart

    public int getStart()

Description copied from interface: `DOMRange`
Returns the start offset of the node.

Specified by:
  `getStart` in interface `DOMRange`
Returns:
  the start offset of the node.

#### getEnd

    public int getEnd()

Description copied from interface: `DOMRange`
Returns the end offset of the node.

Specified by:
  `getEnd` in interface `DOMRange`
Returns:
  the end offset of the node.

#### getOwnerDocument

    public DOMDocument getOwnerDocument()

Description copied from interface: `DOMRange`
Returns the owner document.

Specified by:
  `getOwnerDocument` in interface `DOMRange`
Returns:
  the owner document.

#### getDirection

    public SearchNode.Direction getDirection()

#### createRange

    public org.eclipse.lsp4j.Range createRange()

#### createRange

    public org.eclipse.lsp4j.Range createRange​(boolean checkPrefix)

#### isNeedToAjdustWithPrefix

    public boolean isNeedToAjdustWithPrefix()

#### isValid

    public boolean isValid()

Returns true if the search node is valid and false otherwise. The node is valid when:

- the search node is a 'to' node.
- the 'from' search node have none prefix.
- the 'from' search node have the expected prefix.

Returns:
  true if the search node has valid prefix and false otherwise

#### getValidationStatus

    public SearchNode.ValidationStatus getValidationStatus()

Returns the validation status of the search node.

Returns:
  the validation status of the search node.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`