Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2000, 2009 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: IBM Corporation - initial API and implementation /
 
 package org.eclipse.jdt.internal.core.jdom;
 
DOMInitializer provides an implementation of IDOMInitializer.

Deprecated:
The JDOM was made obsolete by the addition in 2.0 of the more powerful, fine-grained DOM/AST API found in the org.eclipse.jdt.core.dom package.
See also:
IDOMInitializer
DOMNode
 
 class DOMInitializer extends DOMMember implements IDOMInitializer {

The contents of the initializer's body when the body has been altered from the contents in the document, otherwise null.
 
 	protected String fBody;

The original inclusive source range of the body in the document.
 
 	protected int[]  fBodyRange;

Constructs an empty initializer node.
 
 	// Constructs an empty initializer node
 }
Creates a new detailed INITIALIZER document fragment on the given range of the document.

Parameters:
document - the document containing this node's original contents
sourceRange - a two element array of integers describing the entire inclusive source range of this node within its document. Contents start on and include the character at the first position. Contents end on and include the character at the last position. An array of -1's indicates this node's contents do not exist in the document.
commentRange - a two element array describing the comments that precede the member declaration. The first matches the start of this node's sourceRange, and the second is the new-line or first non-whitespace character following the last comment. If no comments are present, this array contains two -1's.
flags - an integer representing the modifiers for this member. The integer can be analyzed with org.eclipse.jdt.core.Flags
modifierRange - a two element array describing the location of modifiers for this member within its source range. The first integer is the first character of the first modifier for this member, and the second integer is the last whitespace character preceeding the next part of this member declaration. If there are no modifiers present in this node's source code (that is, package default visibility), this array contains two -1's.
bodyStartPosition - the position of the open brace of the body of this initialzer.
 
 DOMInitializer(char[] documentint[] sourceRangeint[] commentRangeint flagsint[] modifierRangeint bodyStartPosition) {
 	super(documentsourceRangenullnew int[]{-1, -1}, commentRangeflagsmodifierRange);
 	this.new int[2];
 	this.[0]= bodyStartPosition;
 	this.[1]= sourceRange[1];
 	setHasBody(true);
 }
Creates a new simple INITIALIZER document fragment on the given range of the document.

Parameters:
document - the document containing this node's original contents
sourceRange - a two element array of integers describing the entire inclusive source range of this node within its document. Contents start on and include the character at the first position. Contents end on and include the character at the last position. An array of -1's indicates this node's contents do not exist in the document.
flags - an integer representing the modifiers for this member. The integer can be analyzed with org.eclipse.jdt.core.Flags
 
 DOMInitializer(char[] documentint[] sourceRangeint flags) {
 	this(documentsourceRangenew int[] {-1, -1}, flagsnew int[] {-1, -1}, -1);

See also:
DOMMember.appendMemberBodyContents(CharArrayBuffer)
protected void appendMemberBodyContents(CharArrayBuffer buffer) {
	if (hasBody()) {
		buffer
			.append(this.this.[1] + 1, this.[1] - this.[1]);
else {
		buffer.append("{}").append(Util.getLineSeparator(buffer.toString(), null)); //$NON-NLS-1$
	}

See also:
DOMMember.appendMemberDeclarationContents(CharArrayBuffer)
	// nothing to do

See also:
DOMMember.appendSimpleContents(CharArrayBuffer)
protected void appendSimpleContents(CharArrayBuffer buffer) {
	// append eveything before my name
	buffer.append(this.this.[0], this.[0] - this.[0]);
	// append my name
	buffer.append(this.);
	// append everything after my name
	buffer.append(this.this.[1] + 1, this.[1] - this.[1]);

See also:
IDOMInitializer.getBody()
public String getBody() {
	if (hasBody()) {
		if (this. != null) {
			return this.;
else {
			return new String(this.this.[0], this.[1] + 1 - this.[0]);
		}
else {
		return null;
	}

See also:
DOMNode.getDetailedNode()
protected DOMNode getDetailedNode() {

See also:
IDOMNode.getJavaElement
	if (parent.getElementType() == .) {
		int count = 1;
		IDOMNode previousNode = getPreviousNode();
		while (previousNode != null) {
			if (previousNode instanceof DOMInitializer) {
				count++;
			}
			previousNode = previousNode.getPreviousNode();
		}
		return ((ITypeparent).getInitializer(count);
else {
	}

See also:
DOMMember.getMemberDeclarationStartPosition()
	return this.[0];

See also:
IDOMNode.getNodeType()
public int getNodeType() {

See also:
IDOMNode.isSignatureEqual(IDOMNode)

This method always answers false since an initializer does not have a signature.

public boolean isSignatureEqual(IDOMNode node) {
	return false;

See also:
DOMNode
protected DOMNode newDOMNode() {
	return new DOMInitializer();
Offsets all the source indexes in this node by the given amount.
protected void offset(int offset) {
	super.offset(offset);
	offsetRange(this.offset);

See also:
IDOMInitializer.setBody(String)
public void setBody(String body) {
	this.body;
	setHasBody(body != null);

See also:
IDOMInitializer.setName(String)
public void setName(String name) {
	// initializers have no name

See also:
DOMNode.shareContents(DOMNode)
protected void shareContents(DOMNode node) {
	super.shareContents(node);
	this.init.fBody;
	this.rangeCopy(init.fBodyRange);

See also:
IDOMNode.toString()
public String toString() {
	return "INITIALIZER"//$NON-NLS-1$
New to GrepCode? Check out our FAQ X