mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
986bf0206b
commit
4071a34762
1 changed files with 49 additions and 49 deletions
|
@ -17,20 +17,21 @@ import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||
|
||||
/**
|
||||
* @author dsteffle
|
||||
*/
|
||||
public class DOMASTNodeParent extends DOMASTNodeLeaf {
|
||||
private static final int NO_PREPROCESSOR_STATMENT = -1;
|
||||
private static final DOMASTNodeLeaf[] EMPTY_CHILDREN_ARRAY = new DOMASTNodeLeaf[0];
|
||||
private static final int NO_PREPROCESSOR_STATEMENT = -1;
|
||||
private static final DOMASTNodeLeaf[] EMPTY_CHILDREN_ARRAY = {};
|
||||
private static final int DEFAULT_NODE_CHAIN_SIZE = 4;
|
||||
private static final int DEFAULT_CHILDREN_SIZE = 4;
|
||||
int index=0;
|
||||
int index;
|
||||
private DOMASTNodeLeaf[] children;
|
||||
boolean cleanupedElements = false;
|
||||
private int indexFirstPreproStmnt=NO_PREPROCESSOR_STATMENT;
|
||||
boolean cleanupedElements;
|
||||
private int indexFirstPreproStmnt= NO_PREPROCESSOR_STATEMENT;
|
||||
|
||||
public int getStartSearch() {
|
||||
return index;
|
||||
|
@ -46,7 +47,7 @@ public class DOMASTNodeParent extends DOMASTNodeLeaf {
|
|||
children = new DOMASTNodeLeaf[DEFAULT_CHILDREN_SIZE];
|
||||
}
|
||||
public void addChild(DOMASTNodeLeaf child) {
|
||||
if (child.getNode() instanceof IASTPreprocessorStatement && indexFirstPreproStmnt == NO_PREPROCESSOR_STATMENT) {
|
||||
if (child.getNode() instanceof IASTPreprocessorStatement && indexFirstPreproStmnt == NO_PREPROCESSOR_STATEMENT) {
|
||||
indexFirstPreproStmnt=index;
|
||||
}
|
||||
|
||||
|
@ -96,12 +97,12 @@ public class DOMASTNodeParent extends DOMASTNodeLeaf {
|
|||
* @param pos
|
||||
* @return
|
||||
*/
|
||||
public Object[] insert(Class c, Object[] array, Object obj, int pos) {
|
||||
public <T> T[] insert(Class<T> c, T[] array, T obj, int pos) {
|
||||
if (pos < 0 || pos >= array.length) {
|
||||
return ArrayUtil.append(c, array, obj);
|
||||
}
|
||||
|
||||
Object[] temp = (Object[]) Array.newInstance( c, array.length + 1 );
|
||||
T[] temp = (T[]) Array.newInstance(c, array.length + 1);
|
||||
if (pos > 0) {
|
||||
System.arraycopy(array, 0, temp, 0, pos);
|
||||
temp[pos] = obj;
|
||||
|
@ -394,5 +395,4 @@ public class DOMASTNodeParent extends DOMASTNodeLeaf {
|
|||
public void setChildren(DOMASTNodeLeaf[] children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue