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 givenXMLReferenceExpression.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 Modifier and Type Class Description static classSearchNode.Directionstatic classSearchNode.ValidationStatus
-
Constructor Summary
Constructors Constructor Description SearchNode(int start, int end, DOMNode node, String prefix, SearchNode.Direction direction)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.eclipse.lsp4j.RangecreateRange()org.eclipse.lsp4j.RangecreateRange(boolean checkPrefix)SearchNode.DirectiongetDirection()intgetEnd()Returns the end offset of the node.DOMNodegetNode()DOMDocumentgetOwnerDocument()Returns the owner document.StringgetPrefix()intgetStart()Returns the start offset of the node.SearchNode.ValidationStatusgetValidationStatus()Returns the validation status of the search node.StringgetValue(String forcedPrefix)booleanisNeedToAjdustWithPrefix()booleanisValid()Returns true if the search node is valid and false otherwise.booleanmatchesValue(SearchNode searchNode)Returns true if the given search nodesearchNodematches the value of this search node and false otherwise.StringtoString()
-
-
-
Constructor Detail
-
SearchNode
public SearchNode(int start, int end, DOMNode node, String prefix, SearchNode.Direction direction)
-
-
Method Detail
-
getPrefix
public String getPrefix()
-
matchesValue
public boolean matchesValue(SearchNode searchNode)
Returns true if the given search nodesearchNodematches the value of this search node and false otherwise.- Parameters:
searchNode- the search node.- Returns:
- true if the given search node
searchNodematches the value of this search node and false otherwise.
-
getNode
public DOMNode getNode()
-
getStart
public int getStart()
Description copied from interface:DOMRangeReturns the start offset of the node.
-
getEnd
public int getEnd()
Description copied from interface:DOMRangeReturns the end offset of the node.
-
getOwnerDocument
public DOMDocument getOwnerDocument()
Description copied from interface:DOMRangeReturns the owner document.- Specified by:
getOwnerDocumentin interfaceDOMRange- 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.
-
-