From a9e1167971a642c995d75dde173800917b4764ea Mon Sep 17 00:00:00 2001 From: John Camelon Date: Wed, 9 Mar 2005 02:42:54 +0000 Subject: [PATCH] Add JavaDoc. --- .../cdt/core/dom/ast/ASTCompletionNode.java | 21 +++ .../cdt/core/dom/ast/ASTNodeProperty.java | 2 +- .../eclipse/cdt/core/dom/ast/ASTVisitor.java | 10 +- .../cdt/core/dom/ast/DOMException.java | 11 ++ .../cdt/core/dom/ast/IASTASMDeclaration.java | 10 ++ .../cdt/core/dom/ast/IASTArrayDeclarator.java | 15 +- .../cdt/core/dom/ast/IASTArrayModifier.java | 19 +++ .../dom/ast/IASTArraySubscriptExpression.java | 26 +++ .../core/dom/ast/IASTBinaryExpression.java | 155 ++++++++++++++++++ .../cdt/core/dom/ast/IASTCaseStatement.java | 7 + .../cdt/core/dom/ast/IASTCastExpression.java | 42 +++++ 11 files changed, 314 insertions(+), 4 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTCompletionNode.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTCompletionNode.java index 812e88d9014..d4dc4c56c97 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTCompletionNode.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTCompletionNode.java @@ -30,10 +30,20 @@ public class ASTCompletionNode { private IToken completionToken; private List names = new ArrayList(); + /** + * Only constructor. + * + * @param completionToken - the completion token + */ public ASTCompletionNode(IToken completionToken) { this.completionToken = completionToken; } + /** + * Add a name to node. + * + * @param name + */ public void addName(IASTName name) { names.add(name); } @@ -48,10 +58,21 @@ public class ASTCompletionNode { return completionToken.getImage(); } + /** + * Get the length of the completion point. + * + * @return length of completion token + */ public int getLength() { return completionToken.getLength(); } + + /** + * Get a list of names that fit in this context. + * + * @return array of IASTName's + */ public IASTName[] getNames() { return (IASTName[])names.toArray(new IASTName[names.size()]); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTNodeProperty.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTNodeProperty.java index 8da2987bf10..4a07d016d4d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTNodeProperty.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTNodeProperty.java @@ -23,7 +23,7 @@ public class ASTNodeProperty { private String name; /** - * @param n + * @param n name */ public ASTNodeProperty(String n) { this.name = n; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTVisitor.java index 97ecf1e2148..86fabe74e48 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTVisitor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTVisitor.java @@ -18,6 +18,10 @@ import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator; public abstract class ASTVisitor { + + /** + * These values should be overriden in the implementation subclass. + */ public boolean shouldVisitNames = false; public boolean shouldVisitDeclarations = false; public boolean shouldVisitInitializers = false; @@ -37,7 +41,11 @@ public abstract class ASTVisitor { public final static int PROCESS_ABORT = 2; public final static int PROCESS_CONTINUE = 3; - + /** + * + * visit methods + * + */ public int visit( IASTTranslationUnit tu ) { return PROCESS_CONTINUE; } public int visit( IASTName name ) { return PROCESS_CONTINUE; } public int visit( IASTDeclaration declaration ) { return PROCESS_CONTINUE; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/DOMException.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/DOMException.java index 1d7edf8437d..2d41ea2e3d7 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/DOMException.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/DOMException.java @@ -17,11 +17,17 @@ package org.eclipse.cdt.core.dom.ast; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPSemantics; /** + * This is the general purpose exception that is thrown for resolving semantic + * aspects of an illegal binding. + * * @author aniefer */ public class DOMException extends Exception { IProblemBinding problemBinding; + + /** + * @param problem binding for throwing * */ public DOMException( IProblemBinding problem ) { @@ -29,6 +35,11 @@ public class DOMException extends Exception { problemBinding = problem; } + /** + * Get the problem associated w/this exception. + * + * @return problem + */ public IProblemBinding getProblem(){ return problemBinding; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTASMDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTASMDeclaration.java index fc3add67aa4..352adfe61fc 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTASMDeclaration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTASMDeclaration.java @@ -11,10 +11,20 @@ package org.eclipse.cdt.core.dom.ast; /** + * ASM Statement as a Declaration. + * * @author jcamelon */ public interface IASTASMDeclaration extends IASTDeclaration { + /** + * Get the assembly value. + * @return + */ public String getAssembly(); + /** + * Set the assembly value. + * @param assembly + */ public void setAssembly( String assembly ); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTArrayDeclarator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTArrayDeclarator.java index f32a4e091dd..bd7e1d597c8 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTArrayDeclarator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTArrayDeclarator.java @@ -10,8 +10,6 @@ **********************************************************************/ package org.eclipse.cdt.core.dom.ast; - - /** * This is the declarator for an array. * @@ -19,9 +17,22 @@ package org.eclipse.cdt.core.dom.ast; */ public interface IASTArrayDeclarator extends IASTDeclarator { + /** + * Node property that describes the relationship between an IASTArrayDeclarator and an IASTArrayModifier. + */ public static final ASTNodeProperty ARRAY_MODIFIER = new ASTNodeProperty( "Array Modifier"); //$NON-NLS-1$ + /** + * Get all IASTArrayModifier's for this declarator. + * + * @return array of IASTArrayModifier + */ public IASTArrayModifier[] getArrayModifiers(); + + /** + * Add an IASTArrayModifier to this declarator + * @param arrayModifier IASTArrayModifier to be added + */ public void addArrayModifier( IASTArrayModifier arrayModifier ); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTArrayModifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTArrayModifier.java index 6e9fd4c73d6..84873468493 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTArrayModifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTArrayModifier.java @@ -10,13 +10,32 @@ package org.eclipse.cdt.core.dom.ast; /** + * This is the portion of the node that represents the portions when someone declares a + * variable/type which is an array. + * * @author jcamelon */ public interface IASTArrayModifier extends IASTNode { + /** + * Node property that describes the relationship between an IASTArrayModifier and an IASTExpression. + */ public static final ASTNodeProperty CONSTANT_EXPRESSION = new ASTNodeProperty( "Constant Expression"); //$NON-NLS-1$ + /** + * EMPTY_ARRAY is referred to in implementations + */ public static final IASTArrayModifier[] EMPTY_ARRAY = new IASTArrayModifier[0]; + /** + * Get the constant expression that represents the size of the array. + * + * @return IASTExpression + */ public IASTExpression getConstantExpression(); + /** + * Set the constant expression that represents the size of the array. + * + * @param expression IASTExpression + */ public void setConstantExpression( IASTExpression expression ); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTArraySubscriptExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTArraySubscriptExpression.java index f352fc90a31..39d7cee9d14 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTArraySubscriptExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTArraySubscriptExpression.java @@ -10,15 +10,41 @@ package org.eclipse.cdt.core.dom.ast; /** + * This interface represents a postfix array subscript expression. + * x[ 10 ] + * y.z()[ t * t ] + * * @author jcamelon */ public interface IASTArraySubscriptExpression extends IASTExpression { + /** + * Node property that describes the relationship between an IASTArraySubscriptExpression and an IASTExpression representing the subscript. + */ public static final ASTNodeProperty ARRAY = new ASTNodeProperty( "Array"); //$NON-NLS-1$ + /** + * Get the expression that represents the array. + * @return IASTExpression that represents the array. + */ public IASTExpression getArrayExpression(); + /** + * Set the expression that represents the array. + * @param expression IASTExpression to be set. + */ public void setArrayExpression( IASTExpression expression ); + /** + * Node property that describes the relationship between an IASTArraySubscriptExpression and an IASTExpression representing the array. + */ public static final ASTNodeProperty SUBSCRIPT = new ASTNodeProperty( "Subscript"); //$NON-NLS-1$ + /** + * Get the subscript expression. + * @return IASTExpression that represents the subscript. + */ public IASTExpression getSubscriptExpression(); + /** + * Set the subscript expression. + * @param expression IASTExpression to be set. + */ public void setSubscriptExpression( IASTExpression expression ); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTBinaryExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTBinaryExpression.java index 6bcd4a40d30..b7da6a282cd 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTBinaryExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTBinaryExpression.java @@ -11,48 +11,203 @@ package org.eclipse.cdt.core.dom.ast; /** + * This interface represents a binary expression. + * * @author Doug Schaefer */ public interface IASTBinaryExpression extends IASTExpression { + /** + * Node property that describes the relationship between an IASTBinaryExpression and an IASTExpression representing the lhs. + */ public static final ASTNodeProperty OPERAND_ONE = new ASTNodeProperty( "Operand 1"); //$NON-NLS-1$ + /** + * Node property that describes the relationship between an IASTBinaryExpression and an IASTExpression representing the rhs. + */ public static final ASTNodeProperty OPERAND_TWO = new ASTNodeProperty( "Operand 2"); //$NON-NLS-1$ + /** + * Set the operator. + * @param op Value to set. + */ public void setOperator( int op ); + /** + * Get the operator. + * @return int value as operator + */ public int getOperator(); + + + /** + * multiply * + */ public static final int op_multiply = 1; + /** + * divide / + */ public static final int op_divide = 2; + + /** + * modulo % + */ public static final int op_modulo = 3; + + /** + * plus + + */ public static final int op_plus = 4; + + /** + * minus - + */ public static final int op_minus = 5; + + /** + * shift left << + */ public static final int op_shiftLeft = 6; + + /** + * shift right >> + */ public static final int op_shiftRight = 7; + + /** + * less than < + */ public static final int op_lessThan = 8; + + /** + * greater than > + */ public static final int op_greaterThan = 9; + + /** + * less than or equals <= + */ public static final int op_lessEqual = 10; + + /** + * greater than or equals >= + */ public static final int op_greaterEqual = 11; + + /** + * binary and & + */ public static final int op_binaryAnd = 12; + + /** + * binary Xor ^ + */ public static final int op_binaryXor = 13; + + /** + * binary Or | + */ public static final int op_binaryOr = 14; + + /** + * logical and && + */ public static final int op_logicalAnd = 15; + + /** + * logical or || + */ public static final int op_logicalOr = 16; + + /** + * assignment = + */ public static final int op_assign = 17; + + /** + * multiply assignment *= + */ public static final int op_multiplyAssign = 18; + + /** + * divide assignemnt /= + */ public static final int op_divideAssign = 19; + + /** + * modulo assignment %= + */ public static final int op_moduloAssign = 20; + + /** + * plus assignment += + */ public static final int op_plusAssign = 21; + + /** + * minus assignment -= + */ public static final int op_minusAssign = 22; + + /** + * shift left assignment <<= + */ public static final int op_shiftLeftAssign = 23; + + /** + * shift right assign >>= + */ public static final int op_shiftRightAssign = 24; + + /** + * binary and assign &= + */ public static final int op_binaryAndAssign = 25; + + /** + * binary Xor assign ^= + */ public static final int op_binaryXorAssign = 26; + + /** + * binary Or assign |= + */ public static final int op_binaryOrAssign = 27; + + /** + * equals == + */ public static final int op_equals = 28; + + /** + * not equals != + */ public static final int op_notequals = 29; + + /** + * op_last is the field used in subinterfaces to start their operators at + */ public static final int op_last = op_notequals; + /** + * Get the first operand. + * + * @return IASTExpression representing operand 1. + */ public IASTExpression getOperand1(); + /** + * Set the first operand. + * + * @param expression IASTExpression value. + */ + public void setOperand1( IASTExpression expression ); + /** + * Get the second operand. + * + * @return IASTExpression representing operand 2. + */ public IASTExpression getOperand2(); + /** + * @param expression IASTExpression value + */ public void setOperand2( IASTExpression expression ); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTCaseStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTCaseStatement.java index b32d3fbfb3a..9a6460eeb92 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTCaseStatement.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTCaseStatement.java @@ -20,6 +20,9 @@ package org.eclipse.cdt.core.dom.ast; */ public interface IASTCaseStatement extends IASTStatement { + /** + * ASTNodeProperty that represents the relationship between a case statement and the expression it contains. + */ public static final ASTNodeProperty EXPRESSION = new ASTNodeProperty("expression"); //$NON-NLS-1$ /** @@ -29,6 +32,10 @@ public interface IASTCaseStatement extends IASTStatement { */ public IASTExpression getExpression(); + /** + * Set the expression. + * @param expression + */ public void setExpression(IASTExpression expression); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTCastExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTCastExpression.java index 3297b262803..7e650015a62 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTCastExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTCastExpression.java @@ -10,23 +10,65 @@ package org.eclipse.cdt.core.dom.ast; /** + * This interface represents a cast expression of the form (TypeId)operand. + * * @author jcamelon */ public interface IASTCastExpression extends IASTExpression { + /** + * op_cast represents a traditional cast. + */ public static final int op_cast = 0; + /** + * op_last for subinterfaces + */ public static final int op_last = op_cast; + /** + * Get the type of cast (as an operator). + * + * @return operator + */ public int getOperator(); + + /** + * Set the operator (type of cast). + * + * @param value + */ public void setOperator( int value ); + /** + * OPERAND represents the relationship between a cast expression and the expression it is casting (operand). + */ public static final ASTNodeProperty OPERAND = new ASTNodeProperty( "Operand" ); //$NON-NLS-1$ + + /** + * Get expression being cast. + * @return IASTExpression the expression being cast + */ public IASTExpression getOperand(); + /** + * Set the expression being cast. + * @param expression IASTExpression the expression to be cast + */ public void setOperand( IASTExpression expression ); + /** + * TYPE_ID represents the relationship between a cast expression and the type cast to. + */ public static final ASTNodeProperty TYPE_ID = new ASTNodeProperty( "Type Id"); //$NON-NLS-1$ + /** + * Set the typeId. + * @param typeId IASTTypeId to be set. + */ public void setTypeId( IASTTypeId typeId ); + /** + * Get the typeId. + * @return IASTTypeId representing type being casted to. + */ public IASTTypeId getTypeId(); }