1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

cleanup: loops to enhanced, @Override, spaces

This commit is contained in:
Andrew Gvozdev 2009-09-11 21:02:23 +00:00
parent e3b9ef08cd
commit ef4d88a354

View file

@ -130,13 +130,12 @@ public class InputType extends BuildObject implements IInputType {
// Load Children // Load Children
IManagedConfigElement[] iElements = element.getChildren(); IManagedConfigElement[] iElements = element.getChildren();
for (int l = 0; l < iElements.length; ++l) { for (IManagedConfigElement elem : iElements) {
IManagedConfigElement iElement = iElements[l]; if (elem.getName().equals(IInputOrder.INPUT_ORDER_ELEMENT_NAME)) {
if (iElement.getName().equals(IInputOrder.INPUT_ORDER_ELEMENT_NAME)) { InputOrder inputOrder = new InputOrder(this, elem);
InputOrder inputOrder = new InputOrder(this, iElement);
getInputOrderList().add(inputOrder); getInputOrderList().add(inputOrder);
} else if (iElement.getName().equals(IAdditionalInput.ADDITIONAL_INPUT_ELEMENT_NAME)) { } else if (elem.getName().equals(IAdditionalInput.ADDITIONAL_INPUT_ELEMENT_NAME)) {
AdditionalInput addlInput = new AdditionalInput(this, iElement); AdditionalInput addlInput = new AdditionalInput(this, elem);
getAdditionalInputList().add(addlInput); getAdditionalInputList().add(addlInput);
} }
} }
@ -188,8 +187,7 @@ public class InputType extends BuildObject implements IInputType {
// Load children // Load children
ICStorageElement configElements[] = element.getChildren(); ICStorageElement configElements[] = element.getChildren();
for (int i = 0; i < configElements.length; ++i) { for (ICStorageElement configElement : configElements) {
ICStorageElement configElement = configElements[i];
if (configElement.getName().equals(IInputOrder.INPUT_ORDER_ELEMENT_NAME)) { if (configElement.getName().equals(IInputOrder.INPUT_ORDER_ELEMENT_NAME)) {
InputOrder inputOrder = new InputOrder(this, configElement); InputOrder inputOrder = new InputOrder(this, configElement);
getInputOrderList().add(inputOrder); getInputOrderList().add(inputOrder);
@ -225,22 +223,22 @@ public class InputType extends BuildObject implements IInputType {
// Copy the remaining attributes // Copy the remaining attributes
if (inputType.sourceContentTypeIds != null) { if (inputType.sourceContentTypeIds != null) {
sourceContentTypeIds = (String[])inputType.sourceContentTypeIds.clone(); sourceContentTypeIds = inputType.sourceContentTypeIds.clone();
} }
if(inputType.sourceContentTypes != null) { if(inputType.sourceContentTypes != null) {
sourceContentTypes = (IContentType[])inputType.sourceContentTypes.clone(); sourceContentTypes = inputType.sourceContentTypes.clone();
} }
if (inputType.inputExtensions != null) { if (inputType.inputExtensions != null) {
inputExtensions = (String[])inputType.inputExtensions.clone(); inputExtensions = inputType.inputExtensions.clone();
} }
if (inputType.headerContentTypeIds != null) { if (inputType.headerContentTypeIds != null) {
headerContentTypeIds = (String[])inputType.headerContentTypeIds.clone(); headerContentTypeIds = inputType.headerContentTypeIds.clone();
} }
if (inputType.headerContentTypes != null) { if (inputType.headerContentTypes != null) {
headerContentTypes = (IContentType[])inputType.headerContentTypes.clone(); headerContentTypes = inputType.headerContentTypes.clone();
} }
if (inputType.headerExtensions != null) { if (inputType.headerExtensions != null) {
headerExtensions = (String[])inputType.headerExtensions.clone(); headerExtensions = inputType.headerExtensions.clone();
} }
if (inputType.dependencyContentTypeId != null) { if (inputType.dependencyContentTypeId != null) {
@ -470,8 +468,8 @@ public class InputType extends BuildObject implements IInputType {
} }
if(sourceContentTypeIds != null){ if(sourceContentTypeIds != null){
for(int i = 0; i < sourceContentTypeIds.length; i++){ for (String sourceContentTypeId : sourceContentTypeIds) {
IContentType type = manager.getContentType(sourceContentTypeIds[i]); IContentType type = manager.getContentType(sourceContentTypeId);
if(type != null) if(type != null)
list.add(type); list.add(type);
} }
@ -515,8 +513,8 @@ public class InputType extends BuildObject implements IInputType {
} }
if(headerContentTypeIds != null){ if(headerContentTypeIds != null){
for(int i = 0; i < headerContentTypeIds.length; i++){ for (String headerContentTypeId : headerContentTypeIds) {
IContentType type = manager.getContentType(headerContentTypeIds[i]); IContentType type = manager.getContentType(headerContentTypeId);
if(type != null) if(type != null)
list.add(type); list.add(type);
} }
@ -722,14 +720,14 @@ public class InputType extends BuildObject implements IInputType {
Iterator iter = childElements.listIterator(); Iterator iter = childElements.listIterator();
while (iter.hasNext()) { while (iter.hasNext()) {
InputOrder io = (InputOrder) iter.next(); InputOrder io = (InputOrder) iter.next();
ICStorageElement ioElement = element.createChild(InputOrder.INPUT_ORDER_ELEMENT_NAME); ICStorageElement ioElement = element.createChild(IInputOrder.INPUT_ORDER_ELEMENT_NAME);
io.serialize(ioElement); io.serialize(ioElement);
} }
childElements = getAdditionalInputList(); childElements = getAdditionalInputList();
iter = childElements.listIterator(); iter = childElements.listIterator();
while (iter.hasNext()) { while (iter.hasNext()) {
AdditionalInput ai = (AdditionalInput) iter.next(); AdditionalInput ai = (AdditionalInput) iter.next();
ICStorageElement aiElement = element.createChild(AdditionalInput.ADDITIONAL_INPUT_ELEMENT_NAME); ICStorageElement aiElement = element.createChild(IAdditionalInput.ADDITIONAL_INPUT_ELEMENT_NAME);
ai.serialize(aiElement); ai.serialize(aiElement);
} }
@ -885,9 +883,9 @@ public class InputType extends BuildObject implements IInputType {
kind == IAdditionalInput.KIND_ADDITIONAL_INPUT_DEPENDENCY) { kind == IAdditionalInput.KIND_ADDITIONAL_INPUT_DEPENDENCY) {
String[] paths = current.getPaths(); String[] paths = current.getPaths();
if (paths != null) { if (paths != null) {
for (int i = 0; i < paths.length; i++) { for (String path : paths) {
if (paths[i].length() > 0) { if (path.length() > 0) {
deps.add(Path.fromOSString(paths[i])); deps.add(Path.fromOSString(path));
} }
} }
} }
@ -909,9 +907,9 @@ public class InputType extends BuildObject implements IInputType {
kind == IAdditionalInput.KIND_ADDITIONAL_INPUT_DEPENDENCY) { kind == IAdditionalInput.KIND_ADDITIONAL_INPUT_DEPENDENCY) {
String[] paths = current.getPaths(); String[] paths = current.getPaths();
if (paths != null) { if (paths != null) {
for (int i = 0; i < paths.length; i++) { for (String path : paths) {
if (paths[i].length() > 0) { if (path.length() > 0) {
ins.add(Path.fromOSString(paths[i])); ins.add(Path.fromOSString(path));
} }
} }
} }
@ -955,6 +953,7 @@ public class InputType extends BuildObject implements IInputType {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IInputType#getName() * @see org.eclipse.cdt.core.build.managed.IInputType#getName()
*/ */
@Override
public String getName() { public String getName() {
return (name == null && superClass != null) ? superClass.getName() : name; return (name == null && superClass != null) ? superClass.getName() : name;
} }
@ -1061,8 +1060,8 @@ public class InputType extends BuildObject implements IInputType {
// add "h" to the list if it is not already there. // add "h" to the list if it is not already there.
if (type.getId().compareTo("org.eclipse.cdt.core.cxxHeader") == 0) { //$NON-NLS-1$ if (type.getId().compareTo("org.eclipse.cdt.core.cxxHeader") == 0) { //$NON-NLS-1$
boolean h_found = false; boolean h_found = false;
for (int i=0; i<exts.length; i++) { for (String ext : exts) {
if (exts[i].compareTo("h") == 0) { //$NON-NLS-1$ if (ext.compareTo("h") == 0) { //$NON-NLS-1$
h_found = true; h_found = true;
break; break;
} }
@ -1087,8 +1086,8 @@ public class InputType extends BuildObject implements IInputType {
*/ */
public boolean isDependencyExtension(ITool tool, String ext) { public boolean isDependencyExtension(ITool tool, String ext) {
String[] exts = getDependencyExtensions(tool); String[] exts = getDependencyExtensions(tool);
for (int i=0; i<exts.length; i++) { for (String depExt : exts) {
if (ext.equals(exts[i])) return true; if (ext.equals(depExt)) return true;
} }
return false; return false;
} }
@ -1262,7 +1261,7 @@ public class InputType extends BuildObject implements IInputType {
return new IContentType[0]; return new IContentType[0];
} }
return (IContentType[])sourceContentTypes.clone(); return sourceContentTypes.clone();
} }
public IContentType[] getHeaderContentTypes() { public IContentType[] getHeaderContentTypes() {
@ -1273,7 +1272,7 @@ public class InputType extends BuildObject implements IInputType {
return new IContentType[0]; return new IContentType[0];
} }
return (IContentType[])headerContentTypes.clone(); return headerContentTypes.clone();
} }
public String[] getHeaderExtensionsAttribute() { public String[] getHeaderExtensionsAttribute() {
@ -1284,7 +1283,7 @@ public class InputType extends BuildObject implements IInputType {
return new String[0]; return new String[0];
} }
return (String[])headerExtensions.clone(); return headerExtensions.clone();
} }
@ -1297,7 +1296,7 @@ public class InputType extends BuildObject implements IInputType {
return new String[0]; return new String[0];
} }
return (String[])headerContentTypeIds.clone(); return headerContentTypeIds.clone();
} }
public String[] getSourceContentTypeIds() { public String[] getSourceContentTypeIds() {
@ -1308,7 +1307,7 @@ public class InputType extends BuildObject implements IInputType {
return new String[0]; return new String[0];
} }
return (String[])sourceContentTypeIds.clone(); return sourceContentTypeIds.clone();
} }
public void setHeaderContentTypeIds(String[] ids) { public void setHeaderContentTypeIds(String[] ids) {
@ -1386,7 +1385,7 @@ public class InputType extends BuildObject implements IInputType {
setRebuildState(true); setRebuildState(true);
} }
} else { } else {
sourceContentTypes = (IContentType[])types.clone(); sourceContentTypes = types.clone();
sourceContentTypeIds = new String[types.length]; sourceContentTypeIds = new String[types.length];
for(int i = 0; i < types.length; i++){ for(int i = 0; i < types.length; i++){
sourceContentTypeIds[i] = types[i].getId(); sourceContentTypeIds[i] = types[i].getId();
@ -1409,7 +1408,7 @@ public class InputType extends BuildObject implements IInputType {
return new String[0]; return new String[0];
} }
return (String[])inputExtensions.clone(); return inputExtensions.clone();
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -1463,10 +1462,8 @@ public class InputType extends BuildObject implements IInputType {
// Use content type if specified and registered with Eclipse // Use content type if specified and registered with Eclipse
IContentType types[] = getSourceContentTypes(); IContentType types[] = getSourceContentTypes();
if (types.length != 0) { if (types.length != 0) {
IContentType type;
List list = new ArrayList(); List list = new ArrayList();
for(int i = 0; i < types.length; i++){ for (IContentType type : types) {
type = types[i];
list.addAll(Arrays.asList(((Tool)tool).getContentTypeFileSpecs(type, project))); list.addAll(Arrays.asList(((Tool)tool).getContentTypeFileSpecs(type, project)));
} }
return (String[])list.toArray(new String[list.size()]); return (String[])list.toArray(new String[list.size()]);
@ -1478,10 +1475,8 @@ public class InputType extends BuildObject implements IInputType {
public String[] getHeaderExtensions(ITool tool) { public String[] getHeaderExtensions(ITool tool) {
IContentType types[] = getHeaderContentTypes(); IContentType types[] = getHeaderContentTypes();
if (types.length != 0) { if (types.length != 0) {
IContentType type;
List list = new ArrayList(); List list = new ArrayList();
for(int i = 0; i < types.length; i++){ for (IContentType type : types) {
type = types[i];
list.addAll(Arrays.asList(((Tool)tool).getContentTypeFileSpecs(type))); list.addAll(Arrays.asList(((Tool)tool).getContentTypeFileSpecs(type)));
} }
return (String[])list.toArray(new String[list.size()]); return (String[])list.toArray(new String[list.size()]);
@ -1498,8 +1493,8 @@ public class InputType extends BuildObject implements IInputType {
public boolean isSourceExtension(ITool tool, String ext, IProject project) { public boolean isSourceExtension(ITool tool, String ext, IProject project) {
String[] exts = getSourceExtensions(tool, project); String[] exts = getSourceExtensions(tool, project);
for (int i=0; i<exts.length; i++) { for (String srcExt : exts) {
if (ext.equals(exts[i])) return true; if (ext.equals(srcExt)) return true;
} }
return false; return false;
} }
@ -1580,8 +1575,8 @@ public class InputType extends BuildObject implements IInputType {
IContentTypeManager manager = Platform.getContentTypeManager(); IContentTypeManager manager = Platform.getContentTypeManager();
List list = new ArrayList(); List list = new ArrayList();
if (sourceContentTypeIds != null) { if (sourceContentTypeIds != null) {
for(int i = 0; i < sourceContentTypeIds.length; i++){ for (String sourceContentTypeId : sourceContentTypeIds) {
IContentType type = manager.getContentType(sourceContentTypeIds[i]); IContentType type = manager.getContentType(sourceContentTypeId);
if(type != null) if(type != null)
list.add(type); list.add(type);
} }
@ -1594,8 +1589,8 @@ public class InputType extends BuildObject implements IInputType {
} }
if (headerContentTypeIds != null) { if (headerContentTypeIds != null) {
for(int i = 0; i < headerContentTypeIds.length; i++){ for (String headerContentTypeId : headerContentTypeIds) {
IContentType type = manager.getContentType(headerContentTypeIds[i]); IContentType type = manager.getContentType(headerContentTypeId);
if(type != null) if(type != null)
list.add(type); list.add(type);
} }
@ -1628,6 +1623,7 @@ public class InputType extends BuildObject implements IInputType {
/** /**
* @return Returns the managedBuildRevision. * @return Returns the managedBuildRevision.
*/ */
@Override
public String getManagedBuildRevision() { public String getManagedBuildRevision() {
if ( managedBuildRevision == null) { if ( managedBuildRevision == null) {
if ( getParent() != null) { if ( getParent() != null) {
@ -1640,6 +1636,7 @@ public class InputType extends BuildObject implements IInputType {
/** /**
* @return Returns the version. * @return Returns the version.
*/ */
@Override
public PluginVersionIdentifier getVersion() { public PluginVersionIdentifier getVersion() {
if ( version == null) { if ( version == null) {
if ( getParent() != null) { if ( getParent() != null) {
@ -1649,6 +1646,7 @@ public class InputType extends BuildObject implements IInputType {
return version; return version;
} }
@Override
public void setVersion(PluginVersionIdentifier version) { public void setVersion(PluginVersionIdentifier version) {
// Do nothing // Do nothing
} }
@ -1768,8 +1766,8 @@ public class InputType extends BuildObject implements IInputType {
langName = getLanguageNameAttribute(); langName = getLanguageNameAttribute();
if(langName == null){ if(langName == null){
IContentType types[] = getSourceContentTypes(); IContentType types[] = getSourceContentTypes();
for(int i = 0; i < types.length; i++){ for (IContentType type : types) {
String name = types[i].getName(); String name = type.getName();
if(name != null && name.length() != 0){ if(name != null && name.length() != 0){
langName = name; langName = name;
break; break;
@ -1778,8 +1776,8 @@ public class InputType extends BuildObject implements IInputType {
if(langName == null){ if(langName == null){
types = getHeaderContentTypes(); types = getHeaderContentTypes();
for(int i = 0; i < types.length; i++){ for (IContentType type : types) {
String name = types[i].getName(); String name = type.getName();
if(name != null && name.length() != 0){ if(name != null && name.length() != 0){
langName = name; langName = name;
break; break;