Package org.eclipse.xtext.nodemodel.impl
Class InternalNodeModelUtils
- java.lang.Object
-
- org.eclipse.xtext.nodemodel.impl.InternalNodeModelUtils
-
- Direct Known Subclasses:
NodeModelUtils
public class InternalNodeModelUtils extends java.lang.Object
Internal base class for node model utilities with access to implementation details of the node model. It is intentional that the methods here are available to clients only with some effort because they rely on internal semantics of the node model implementation.- Since:
- 2.9
- Noreference:
- This class is not intended to be referenced by clients.
- Noextend:
- This class is not intended to be subclassed by clients.
- Noinstantiate:
- This class is not intended to be instantiated by clients.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
InternalNodeModelUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static AbstractNode
basicGetFirstChild(CompositeNode node)
Obtain the first child node of the given node.protected static AbstractNode
basicGetLastChild(CompositeNode node)
Obtain the last child node of the given node.protected static CompositeNode
basicGetParent(AbstractNode node)
Obtain the parent node of the given node.protected static int[]
computeLineBreaks(java.lang.String text)
Computes the line breaks in the given text and returns an array of offsets.protected static org.eclipse.xtext.util.LineAndColumn
getLineAndColumn(java.lang.String text, int[] lineBreaks, int offset)
protected static org.eclipse.xtext.util.LineAndColumn
getLineAndColumn(INode anyNode, int documentOffset)
Obtain the line breaks from the document and search / compute the line number and column number at the given document offset.
-
-
-
Method Detail
-
getLineAndColumn
protected static org.eclipse.xtext.util.LineAndColumn getLineAndColumn(INode anyNode, int documentOffset)
Obtain the line breaks from the document and search / compute the line number and column number at the given document offset.
-
basicGetParent
protected static CompositeNode basicGetParent(AbstractNode node)
Obtain the parent node of the given node. Does not unfoldsynthetic
nodes. May returnnull
.- Since:
- 2.24
-
basicGetFirstChild
protected static AbstractNode basicGetFirstChild(CompositeNode node)
Obtain the first child node of the given node. Does not unfoldsynthetic
nodes. May returnnull
.- Since:
- 2.24
-
basicGetLastChild
protected static AbstractNode basicGetLastChild(CompositeNode node)
Obtain the last child node of the given node. Does not unfoldsynthetic
nodes. May returnnull
.- Since:
- 2.24
-
getLineAndColumn
protected static org.eclipse.xtext.util.LineAndColumn getLineAndColumn(java.lang.String text, int[] lineBreaks, int offset)
-
computeLineBreaks
protected static int[] computeLineBreaks(java.lang.String text)
Computes the line breaks in the given text and returns an array of offsets. A line break is either
This implementation was heavily adapted from\r\n
,\n
, or a single\r
.org.eclipse.jface.text.DefaultLineTracker
. It follows the semantics ofLineNumberReader
. The offsets in the returned array are the offset of the line break itself. If the line-break contains of two characters ('\r\n'), it's the offset of the first char ('\r').- Parameters:
text
- the text whose line-breaks should be computed. May not benull
.- Returns:
- the array of line-break offsets in the given text. May be empty but is never
null
.
-
-