From ef93400be26d365c09dbd51165a257779fb36940 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Mon, 16 Dec 2013 18:38:58 -0800 Subject: [PATCH] Cosmetics. --- .../org/eclipse/cdt/core/model/ICElement.java | 4 ++-- .../cdt/core/model/ICLanguageKeywords.java | 23 ++++++------------- .../org/eclipse/cdt/core/model/IFunction.java | 4 +--- .../eclipse/cdt/core/model/IStructure.java | 18 +++++++++------ .../cdt/internal/core/model/Structure.java | 19 +++++++-------- 5 files changed, 29 insertions(+), 39 deletions(-) diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElement.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElement.java index 52234a139e9..b3c53d1d21e 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElement.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElement.java @@ -12,13 +12,13 @@ *******************************************************************************/ package org.eclipse.cdt.core.model; +import java.net.URI; + import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IPath; -import java.net.URI; - /** * Common protocol for all elements provided by the C model. * diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICLanguageKeywords.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICLanguageKeywords.java index 9845990712b..a09d9395a68 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICLanguageKeywords.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICLanguageKeywords.java @@ -12,38 +12,29 @@ package org.eclipse.cdt.core.model; /** * This is an optional extension interface to {@link ILanguage} which allows - * a C/C++ language variant to expose the set of keywords it defines. + * a C/C++ language variant to expose the set of keywords it defines. * - *

- * EXPERIMENTAL. This class or interface has been added as - * part of a work in progress. There is no guarantee that this API will work or - * that it will remain the same. Please do not use this API without consulting - * with the CDT team. - *

- * * @since 4.0 */ public interface ICLanguageKeywords { - /** - * Get the keywords defined for this language, excluding bult-in types. - * + * Returns the keywords defined for this language, excluding built-in types. + * * @return an array of keywords, never null */ public abstract String[] getKeywords(); /** - * Get the built-in type names defined for this language. - * + * Returns the built-in type names defined for this language. + * * @return an array of names, never null */ public abstract String[] getBuiltinTypes(); /** - * Get the preprocessor keywords (directives) defined for this language. - * + * Returns the preprocessor keywords (directives) defined for this language. + * * @return an array of keywords, never null */ public abstract String[] getPreprocessorKeywords(); - } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IFunction.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IFunction.java index 0221935f2a3..b8d50ed1ba8 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IFunction.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IFunction.java @@ -10,13 +10,11 @@ *******************************************************************************/ package org.eclipse.cdt.core.model; - /** * Represents a function definition. - * + * * @noextend This interface is not intended to be extended by clients. * @noimplement This interface is not intended to be implemented by clients. */ public interface IFunction extends IFunctionDeclaration { - } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IStructure.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IStructure.java index b3a3e7eb4b6..84bc06b31ca 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IStructure.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IStructure.java @@ -8,20 +8,24 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.core.model; /** * Represent struct(ure), class or union. - * + * * @noextend This interface is not intended to be extended by clients. * @noimplement This interface is not intended to be implemented by clients. */ public interface IStructure extends IInheritance, IParent, IStructureDeclaration { - public IField getField(String name); - /** - * Returns the fields of a structure. + * Returns the specific field with the given name within the structure. + * @param name the name of the field + * @return the field with the given name, or {@code null} if not found + */ + public IField getField(String name); + + /** + * Returns the fields of a structure. * @return an array of IField elements * @throws CModelException */ @@ -29,12 +33,12 @@ public interface IStructure extends IInheritance, IParent, IStructureDeclaration /** * Returns the specific method with the given name within the structure. - * Returns the first occurance more than one method has the same name. + * Returns the first occurrence more than one method has the same name. * @param name * @return IMethodDeclaration */ public IMethodDeclaration getMethod(String name); - + /** * Returns all methods within the structure. * @return array of IMethodDeclaration. diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Structure.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Structure.java index 342a0bf3006..dd0b97d66ad 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Structure.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Structure.java @@ -8,14 +8,8 @@ * Contributors: * QNX Software Systems - Initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.internal.core.model; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; - import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.IField; @@ -23,8 +17,12 @@ import org.eclipse.cdt.core.model.IMethodDeclaration; import org.eclipse.cdt.core.model.IStructure; import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; -public class Structure extends StructureDeclaration implements IStructure { +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; +public class Structure extends StructureDeclaration implements IStructure { Map superClassesNames = new TreeMap(); public Structure(ICElement parent, int kind, String name) { @@ -43,7 +41,7 @@ public class Structure extends StructureDeclaration implements IStructure { try { IField[] fields = getFields(); for (IField field : fields) { - if(field.getElementName().equals(name)){ + if (field.getElementName().equals(name)){ return field; } } @@ -65,7 +63,7 @@ public class Structure extends StructureDeclaration implements IStructure { try { IMethodDeclaration[] methods = getMethods(); for (IMethodDeclaration method : methods) { - if(method.getElementName().equals(name)){ + if (method.getElementName().equals(name)){ return method; } } @@ -78,7 +76,7 @@ public class Structure extends StructureDeclaration implements IStructure { public boolean isAbstract() throws CModelException { IMethodDeclaration[] methods = getMethods(); for (IMethodDeclaration method : methods) { - if(method.isPureVirtual()) + if (method.isPureVirtual()) return true; } return false; @@ -101,5 +99,4 @@ public class Structure extends StructureDeclaration implements IStructure { public void addSuperClass(String name, ASTAccessVisibility access) { superClassesNames.put(name, access); } - }