Klasse DOMNode
IDOMNode
.
A node represents a document fragment. When a node is created, its contents are located in a contiguous range of a shared document. A shared document is a char array, and is shared in the sense that the contents of other document fragments may also be contained in the array.
A node maintains indicies of relevant portions of its contents in the shared document. Thus the original document and indicies create a form from which to generate the contents of the document fragment. As attributes of a node are changed, the node attempts to maintain the original formatting by only replacing relevant portions of the shared document with the value of new attributes (that is, filling in the form with replacement values).
When a node is first created, it is considered unfragmented. When any attribute of the node is altered, the node is then considered fragmented from that point on. A node is also considered fragmented if any of its descendants are fragmented. When a node is unfragmented, the contents of the node can be efficiently generated from the original shared document. When a node is fragmented, the contents of the node must be created using the original document and indicies as a form, filling in replacement values as required.
Generally, a node's contents consists of complete lines in a shared document. The contents of the node are normalized on creation to include any whitespace preceding the node on the line where the node begins, and to include and trailing whitespace up to the line where the next node begins. Any trailing // comments that begin on the line where the current node ends, are considered part of that node.
- Siehe auch:
-
Feldübersicht
Modifizierer und TypFeldBeschreibungprotected char[]
Veraltet.The shared document that the contents for this node are contained in.protected DOMNode
Veraltet.The first child of this node -null
when this node has no children.protected int
Veraltet.This position is the position of the end of the last line separator before the closing brace starting position of the receiver.protected boolean
Veraltet.True when this node has attributes that have been altered from their original state in the shared document, or when the attributes of a descendant have been altered.protected DOMNode
Veraltet.The last child of this node -null
when this node has no children.protected String
Veraltet.The name of this node.protected int[]
Veraltet.The original inclusive indicies of this node's name in the shared document.protected DOMNode
Veraltet.The sibling node following this node -null
for the last node in the sibling list.protected DOMNode
Veraltet.The parent of this node.protected DOMNode
Veraltet.The sibling node preceding this node -null
for the first node in the sibling list.protected int[]
Veraltet.The original entire inclusive range of this node's contents within its document.protected int
Veraltet.The current state of bit masks defined by this node.protected static final int
Veraltet.A bit mask indicating this node has detailed source indexesprotected static final int
Veraltet.A bit mask indicating this field has an initializer expressionprotected static final int
Veraltet.A bit mask indicating this field is a secondary variable declarator for a previous field declaration.protected static final int
Veraltet.A bit mask indicating this field's type has been altered from its original contents in the document.protected static final int
Veraltet.A bit mask indicating this node currently has a body.protected static final int
Veraltet.A bit mask indicating this node currently has a preceding comment.protected static final int
Veraltet.A bit mask indicating this method is a constructor.protected static final int
Veraltet.A bit mask indicating this node's name has been altered from its original contents in the document.protected static final int
Veraltet.A bit mask indicating this return type of this method has been altered from the original contents.protected static final int
Veraltet.A bit mask indicating this type implements or extends some interfacesprotected static final int
Veraltet.A bit mask indicating this type has a superclass (requires or has an 'extends' clause).protected static final int
Veraltet.A bit mask indicating this type is a class.Von Schnittstelle geerbte Felder org.aspectj.org.eclipse.jdt.core.jdom.IDOMNode
COMPILATION_UNIT, FIELD, IMPORT, INITIALIZER, METHOD, PACKAGE, TYPE
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
Veraltet.Adds the given un-parented node (document fragment) as the last child of this node.protected void
appendContents
(CharArrayBuffer buffer) Veraltet.Appends the current contents of this document fragment to the givenCharArrayBuffer
.protected void
Veraltet.Appends the contents of all children of this node to the givenCharArrayBuffer
.protected abstract void
Veraltet.Appends the contents of this node to the givenCharArrayBufer
, using the original document and indicies as a form for the current attribute values of this node.protected void
Veraltet.Generates detailed source indexes for this node if possible.boolean
Veraltet.Returns true if this node is allowed to have children, otherwise false.clone()
Veraltet.Returns a stand-alone copy of the document fragment represented by this node that is in no way dependent on the document this node is part of.protected void
fragment()
Veraltet.Sets this node's fragmented flag and all ancestor fragmented flags totrue
.
char[]
Veraltet.Returns the current contents of this document fragment as a character array.Veraltet.Returns the first named child of this node with the given name.Veraltet.Returns an enumeration of children of this node.Veraltet.Returns the current contents of this document fragment, ornull
if this node has no contents.protected DOMNode
Veraltet.Returns a new document fragment representing this node with detailed source indexes.protected char[]
Veraltet.Returns the document containing this node's original contents.int
Veraltet.Returns the original position of the last character of this node's contents in its document.protected IDOMFactory
Veraltet.Returns a factory with which to create new document fragments.Veraltet.Returns the first child of this node.int
Veraltet.Returns the position at which the first child of this node should be inserted.protected boolean
getMask
(int mask) Veraltet.Returnstrue
if the given mask of this node's state flag is turned on, otherwisefalse
.getName()
Veraltet.Returns the name of this node.protected char[]
Veraltet.Returns the source code to be used for this node's name.Veraltet.Returns the sibling node immediately following this node.Veraltet.Returns the parent of this node.protected int
Veraltet.Answers a source position which corresponds to the end of the parent element's declaration.Veraltet.Returns the sibling node immediately preceding this node.protected IDOMNode
getRoot()
Veraltet.Returns the root node of this document fragment.int
Veraltet.Returns the original position of the first character of this node's contents in its document.void
insertSibling
(IDOMNode sibling) Veraltet.Inserts the given un-parented node as a sibling of this node, immediately before this node.boolean
isAllowableChild
(IDOMNode node) Veraltet.Returns whether the given node is an allowable child for this node.protected boolean
isContentMergableWith
(DOMNode node) Veraltet.Returnstrue
if the contents of this node are from the same document as the given node, the contents of this node immediately follow the contents of the given node, and neither this node or the given node are fragmented - otherwisefalse
.protected boolean
Veraltet.Returnstrue
if this node has detailed source index information, orfalse
if this node has limited source index information.protected boolean
Veraltet.Returnstrue
if this node's or a descendant node's contents have been altered since this node was created.protected boolean
Veraltet.Returnstrue
if this noed's name has been altered from the original document contents.boolean
isSignatureEqual
(IDOMNode node) Veraltet.Returns whether this node's signature is equivalent to the given node's signature.protected void
Veraltet.Localizes the contents of this node and all descendant nodes, such that this node is no longer dependent on its original document in order to generate its contents.protected abstract DOMNode
Veraltet.Returns a new emptyDOMNode
for this instance.protected void
offset
(int offset) Veraltet.Offsets all the source indexes in this node by the given amount.protected void
offsetRange
(int[] range, int offset) Veraltet.Offsets the source range by the given amountprotected int[]
rangeCopy
(int[] range) Veraltet.Returns a copy of the given range.void
remove()
Veraltet.Separates this node from its parent and siblings, maintaining any ties that this node has to the underlying document fragment.protected void
setMask
(int mask, boolean on) Veraltet.Sets the specified mask of this node's state mask on or off based on the boolean value - true -> on, false -> off.void
Veraltet.Sets the name of this node.protected void
setNameAltered
(boolean altered) Veraltet.Sets the state of this node as having its name attribute altered from the original document contents.protected void
setSourceRangeEnd
(int end) Veraltet.Sets the original position of the last character of this node's contents in its document.protected void
setStartPosition
(int start) Veraltet.Sets the original position of the first character of this node's contents in its document.protected void
shareContents
(DOMNode node) Veraltet.Sets the contents of this node and descendant nodes to be the (identical) contents of the given node and its descendants.abstract String
toString()
Veraltet.Returns aString
representing this node - for Debug purposes only.Von Klasse geerbte Methoden java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Von Schnittstelle geerbte Methoden org.aspectj.org.eclipse.jdt.core.jdom.IDOMNode
getJavaElement, getNodeType
-
Felddetails
-
fFirstChild
Veraltet.The first child of this node -null
when this node has no children. (Children of a node are implemented as a doubly linked list). -
fLastChild
Veraltet.The last child of this node -null
when this node has no children. Used for efficient access to the last child when adding new children at the end of the linked list of children. -
fNextNode
Veraltet.The sibling node following this node -null
for the last node in the sibling list. -
fParent
Veraltet.The parent of this node. Anull
parent indicates that this node is a root node of a document fragment. -
fPreviousNode
Veraltet.The sibling node preceding this node -null
for the first node in the sibling list. -
fIsFragmented
protected boolean fIsFragmentedVeraltet.True when this node has attributes that have been altered from their original state in the shared document, or when the attributes of a descendant have been altered. False when the contents of this node and all descendants are consistent with the content of the shared document. -
fName
Veraltet.The name of this node. For efficiency, the name of a node is duplicated in this variable on creation, rather than always having to fetch the name from the shared document. -
fNameRange
protected int[] fNameRangeVeraltet.The original inclusive indicies of this node's name in the shared document. Values of -1 indiciate the name does not exist in the document. -
fDocument
protected char[] fDocumentVeraltet.The shared document that the contents for this node are contained in. Attribute indicies are positions in this character array. -
fSourceRange
protected int[] fSourceRangeVeraltet.The original entire inclusive range of this node's contents within its document. Values of -1 indicate the contents of this node do not exist in the document. -
fStateMask
protected int fStateMaskVeraltet.The current state of bit masks defined by this node. Initially all bit flags are turned off. All bit masks are defined by this class to avoid overlap, although bit masks are node type specific.- Siehe auch:
-
fInsertionPosition
protected int fInsertionPositionVeraltet.This position is the position of the end of the last line separator before the closing brace starting position of the receiver. -
MASK_FIELD_HAS_INITIALIZER
protected static final int MASK_FIELD_HAS_INITIALIZERVeraltet.A bit mask indicating this field has an initializer expression- Siehe auch:
-
MASK_FIELD_IS_VARIABLE_DECLARATOR
protected static final int MASK_FIELD_IS_VARIABLE_DECLARATORVeraltet.A bit mask indicating this field is a secondary variable declarator for a previous field declaration.- Siehe auch:
-
MASK_FIELD_TYPE_ALTERED
protected static final int MASK_FIELD_TYPE_ALTEREDVeraltet.A bit mask indicating this field's type has been altered from its original contents in the document.- Siehe auch:
-
MASK_NAME_ALTERED
protected static final int MASK_NAME_ALTEREDVeraltet.A bit mask indicating this node's name has been altered from its original contents in the document.- Siehe auch:
-
MASK_HAS_BODY
protected static final int MASK_HAS_BODYVeraltet.A bit mask indicating this node currently has a body.- Siehe auch:
-
MASK_HAS_COMMENT
protected static final int MASK_HAS_COMMENTVeraltet.A bit mask indicating this node currently has a preceding comment.- Siehe auch:
-
MASK_IS_CONSTRUCTOR
protected static final int MASK_IS_CONSTRUCTORVeraltet.A bit mask indicating this method is a constructor.- Siehe auch:
-
MASK_TYPE_IS_CLASS
protected static final int MASK_TYPE_IS_CLASSVeraltet.A bit mask indicating this type is a class.- Siehe auch:
-
MASK_TYPE_HAS_SUPERCLASS
protected static final int MASK_TYPE_HAS_SUPERCLASSVeraltet.A bit mask indicating this type has a superclass (requires or has an 'extends' clause).- Siehe auch:
-
MASK_TYPE_HAS_INTERFACES
protected static final int MASK_TYPE_HAS_INTERFACESVeraltet.A bit mask indicating this type implements or extends some interfaces- Siehe auch:
-
MASK_RETURN_TYPE_ALTERED
protected static final int MASK_RETURN_TYPE_ALTEREDVeraltet.A bit mask indicating this return type of this method has been altered from the original contents.- Siehe auch:
-
MASK_DETAILED_SOURCE_INDEXES
protected static final int MASK_DETAILED_SOURCE_INDEXESVeraltet.A bit mask indicating this node has detailed source indexes- Siehe auch:
-
-
Methodendetails
-
addChild
Veraltet.Adds the given un-parented node (document fragment) as the last child of this node.When a child is added, this node must be considered fragmented such that the contents of this node are properly generated.
- Angegeben von:
addChild
in SchnittstelleIDOMNode
- Parameter:
child
- the new child node- Löst aus:
IllegalArgumentException
- if the child isnull
DOMException
- if any of the following conditions hold:- this node is not allowed to have children,
- the child is not of an allowable type
- the child already has a parent
- the child is an ancestor of this node
- Siehe auch:
-
appendContents
Veraltet.Appends the current contents of this document fragment to the givenCharArrayBuffer
.If this node is fragmented, contents must be generated by using the original document and indicies as a form for the current attribute values of this node. If this node not fragmented, the contents can be obtained from the document.
-
appendContentsOfChildren
Veraltet.Appends the contents of all children of this node to the givenCharArrayBuffer
.This algorithm used minimizes String generation by merging adjacent unfragmented children into one substring operation.
-
appendFragmentedContents
Veraltet.Appends the contents of this node to the givenCharArrayBufer
, using the original document and indicies as a form for the current attribute values of this node. -
becomeDetailed
Veraltet.Generates detailed source indexes for this node if possible.- Löst aus:
DOMException
- if unable to generate detailed source indexes for this node
-
canHaveChildren
public boolean canHaveChildren()Veraltet.Returns true if this node is allowed to have children, otherwise false.Default implementation of
IDOMNode
interface method returns false; this method must be overridden by subclasses that implement nodes that allow children.- Angegeben von:
canHaveChildren
in SchnittstelleIDOMNode
- Gibt zurück:
true
if this node can have children- Siehe auch:
-
clone
Veraltet.Beschreibung aus Schnittstelle kopiert:IDOMNode
Returns a stand-alone copy of the document fragment represented by this node that is in no way dependent on the document this node is part of. -
fragment
protected void fragment()Veraltet.Sets this node's fragmented flag and all ancestor fragmented flags totrue
. This happens when an attribute of this node or a descendant node has been altered. When a node is fragmented, its contents must be generated from its attributes and original "form" rather than from the original contents in the document.
-
getCharacters
public char[] getCharacters()Veraltet.Beschreibung aus Schnittstelle kopiert:IDOMNode
Returns the current contents of this document fragment as a character array.Note: To obtain complete source for the source file, ask a compilation unit node for its contents.
- Angegeben von:
getCharacters
in SchnittstelleIDOMNode
- Gibt zurück:
- the contents, or
null
if this node has no contents - Siehe auch:
-
getChild
Veraltet.Beschreibung aus Schnittstelle kopiert:IDOMNode
Returns the first named child of this node with the given name. -
getChildren
Veraltet.Beschreibung aus Schnittstelle kopiert:IDOMNode
Returns an enumeration of children of this node. Returns an empty enumeration if this node has no children (including nodes that cannot have children). Children appear in the order in which they are declared in the source code.- Angegeben von:
getChildren
in SchnittstelleIDOMNode
- Gibt zurück:
- an enumeration of the children
- Siehe auch:
-
getContents
Veraltet.Returns the current contents of this document fragment, ornull
if this node has no contents.If this node is fragmented, contents must be generated by using the original document and indicies as a form for the current attribute values of this node. If this node not fragmented, the contents can be obtained from the document.
- Angegeben von:
getContents
in SchnittstelleIDOMNode
- Gibt zurück:
- the contents, or
null
if this node has no contents - Siehe auch:
-
getDetailedNode
Veraltet.Returns a new document fragment representing this node with detailed source indexes. Subclasses that provide a detailed implementation must override this method. -
getDocument
protected char[] getDocument()Veraltet.Returns the document containing this node's original contents. The document may be shared by other nodes. -
getEndPosition
public int getEndPosition()Veraltet.Returns the original position of the last character of this node's contents in its document. -
getFactory
Veraltet.Returns a factory with which to create new document fragments. -
getFirstChild
Veraltet.Beschreibung aus Schnittstelle kopiert:IDOMNode
Returns the first child of this node. Children appear in the order in which they exist in the source code.- Angegeben von:
getFirstChild
in SchnittstelleIDOMNode
- Gibt zurück:
- the first child, or
null
if this node has no children - Siehe auch:
-
getInsertionPosition
public int getInsertionPosition()Veraltet.Returns the position at which the first child of this node should be inserted. -
getMask
protected boolean getMask(int mask) Veraltet.Returnstrue
if the given mask of this node's state flag is turned on, otherwisefalse
. -
getName
Veraltet.Beschreibung aus Schnittstelle kopiert:IDOMNode
Returns the name of this node. More details are provided in each of the subtypes. -
getNameContents
protected char[] getNameContents()Veraltet.Returns the source code to be used for this node's name. -
getNextNode
Veraltet.Beschreibung aus Schnittstelle kopiert:IDOMNode
Returns the sibling node immediately following this node.- Angegeben von:
getNextNode
in SchnittstelleIDOMNode
- Gibt zurück:
- the next node, or
null
if there is no following node - Siehe auch:
-
getParent
Veraltet.Beschreibung aus Schnittstelle kopiert:IDOMNode
Returns the parent of this node. -
getParentEndDeclaration
protected int getParentEndDeclaration()Veraltet.Answers a source position which corresponds to the end of the parent element's declaration. -
getPreviousNode
Veraltet.Beschreibung aus Schnittstelle kopiert:IDOMNode
Returns the sibling node immediately preceding this node.- Angegeben von:
getPreviousNode
in SchnittstelleIDOMNode
- Gibt zurück:
- the previous node, or
null
if there is no preceding node - Siehe auch:
-
getRoot
Veraltet.Returns the root node of this document fragment. -
getStartPosition
public int getStartPosition()Veraltet.Returns the original position of the first character of this node's contents in its document. -
insertSibling
Veraltet.Beschreibung aus Schnittstelle kopiert:IDOMNode
Inserts the given un-parented node as a sibling of this node, immediately before this node.- Angegeben von:
insertSibling
in SchnittstelleIDOMNode
- Parameter:
sibling
- the new sibling node- Löst aus:
IllegalArgumentException
- if the sibling isnull
DOMException
- if any of the following conditions hold:- this node is a document fragment root
- the sibling is not of the correct type
- the sibling already has a parent
- this sibling is an ancestor of this node
- Siehe auch:
-
isAllowableChild
Veraltet.Beschreibung aus Schnittstelle kopiert:IDOMNode
Returns whether the given node is an allowable child for this node.- Angegeben von:
isAllowableChild
in SchnittstelleIDOMNode
- Parameter:
node
- the potential child node- Gibt zurück:
true
if the given node is an allowable child- Siehe auch:
-
isContentMergableWith
Veraltet.Returnstrue
if the contents of this node are from the same document as the given node, the contents of this node immediately follow the contents of the given node, and neither this node or the given node are fragmented - otherwisefalse
. -
isDetailed
protected boolean isDetailed()Veraltet.Returnstrue
if this node has detailed source index information, orfalse
if this node has limited source index information. To perform some manipulations, detailed indexes are required. -
isFragmented
protected boolean isFragmented()Veraltet.Returnstrue
if this node's or a descendant node's contents have been altered since this node was created. This indicates that the contents of this node are no longer consistent with the contents of this node's document. -
isNameAltered
protected boolean isNameAltered()Veraltet.Returnstrue
if this noed's name has been altered from the original document contents. -
isSignatureEqual
Veraltet.Beschreibung aus Schnittstelle kopiert:IDOMNode
Returns whether this node's signature is equivalent to the given node's signature. In other words, if the nodes were siblings, would the declarations collide because they represent the same declaration.- Angegeben von:
isSignatureEqual
in SchnittstelleIDOMNode
- Parameter:
node
- the other node- Gibt zurück:
true
if the nodes have equivalent signatures- Siehe auch:
-
localizeContents
protected void localizeContents()Veraltet.Localizes the contents of this node and all descendant nodes, such that this node is no longer dependent on its original document in order to generate its contents. This node and all descendant nodes become unfragmented and share a new document. -
newDOMNode
Veraltet.Returns a new emptyDOMNode
for this instance. -
offset
protected void offset(int offset) Veraltet.Offsets all the source indexes in this node by the given amount. -
offsetRange
protected void offsetRange(int[] range, int offset) Veraltet.Offsets the source range by the given amount -
rangeCopy
protected int[] rangeCopy(int[] range) Veraltet.Returns a copy of the given range. -
remove
public void remove()Veraltet.Separates this node from its parent and siblings, maintaining any ties that this node has to the underlying document fragment.When a child is removed, its parent is fragmented such that it properly generates its contents.
-
setMask
protected void setMask(int mask, boolean on) Veraltet.Sets the specified mask of this node's state mask on or off based on the boolean value - true -> on, false -> off. -
setName
Veraltet.Beschreibung aus Schnittstelle kopiert:IDOMNode
Sets the name of this node. Name format depends on node type. More details are provided in each of the subtypes. -
setNameAltered
protected void setNameAltered(boolean altered) Veraltet.Sets the state of this node as having its name attribute altered from the original document contents. -
setSourceRangeEnd
protected void setSourceRangeEnd(int end) Veraltet.Sets the original position of the last character of this node's contents in its document. This method is only used during DOM creation while normalizing the source range of each node. -
setStartPosition
protected void setStartPosition(int start) Veraltet.Sets the original position of the first character of this node's contents in its document. This method is only used during DOM creation while normalizing the source range of each node. -
toString
Veraltet.Returns aString
representing this node - for Debug purposes only.
-