diff options
author | Elliott Baron <ebaron@fedoraproject.org> | 2010-06-26 22:27:34 -0400 |
---|---|---|
committer | Elliott Baron <ebaron@fedoraproject.org> | 2010-06-26 22:27:34 -0400 |
commit | 4e112eca7750a4f530c986be55c178c43c16d3ea (patch) | |
tree | db140c4fe4db9945502398e4869707ca0346353e /org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemCategory.java | |
parent | aa73b3f2503808e4b4029a73368a75b258d6f0dc (diff) | |
download | codan-4e112eca7750a4f530c986be55c178c43c16d3ea.tar.gz codan-4e112eca7750a4f530c986be55c178c43c16d3ea.tar.xz codan-4e112eca7750a4f530c986be55c178c43c16d3ea.zip |
* org.eclipse.cdt.codan.checkers.ui: Updated.
* org.eclipse.cdt.codan.checkers: Updated.
* org.eclipse.cdt.codan.core: Updated.
* org.eclipse.cdt.codan.ui: Updated.
* org.eclipse.cdt.codan.core.cxx: Added.
* org.eclipse.cdt.codan.extension/META-INF/MANIFEST.MF: Import org.eclipse.cdt.codan.core.cxx.model.
* org.eclipse.cdt.codan.extension/src/org/eclipse/cdt/codan/extension/checkers/AbstractPropSimChecker.java: Superclass moved.
Diffstat (limited to 'org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemCategory.java')
-rw-r--r-- | org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemCategory.java | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemCategory.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemCategory.java index fc63480..0156211 100644 --- a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemCategory.java +++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemCategory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Alena Laskavaia + * Copyright (c) 2009, 2010 Alena Laskavaia * 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 @@ -41,40 +41,36 @@ public class CodanProblemCategory implements IProblemCategory, Cloneable { } public IProblemElement[] getChildren() { - return (IProblemElement[]) list.toArray(new IProblemElement[list.size()]); + return list.toArray(new IProblemElement[list.size()]); } public void addChild(IProblemElement p) { list.add(p); } - public IProblem findProblem(String id) { - Object[] children = this.getChildren(); + public static IProblem findProblem(IProblemCategory c, String id) { + Object[] children = c.getChildren(); for (Object object : children) { if (object instanceof IProblemCategory) { IProblemCategory cat = (IProblemCategory) object; - IProblem found = cat.findProblem(id); - if (found != null) - return found; + IProblem found = findProblem(cat, id); + if (found != null) return found; } else if (object instanceof IProblem) { IProblem p = (IProblem) object; - if (p.getId().equals(id)) - return p; + if (p.getId().equals(id)) return p; } } return null; } - public IProblemCategory findCategory(String id) { - if (getId().equals(id)) - return this; - Object[] children = getChildren(); + public static IProblemCategory findCategory(IProblemCategory cat, String id) { + if (cat.getId().equals(id)) return cat; + Object[] children = cat.getChildren(); for (Object object : children) { if (object instanceof IProblemCategory) { - IProblemCategory cat = (IProblemCategory) object; - IProblemCategory found = cat.findCategory(id); - if (found != null) - return found; + IProblemCategory cat2 = (IProblemCategory) object; + IProblemCategory found = findCategory(cat2, id); + if (found != null) return found; } } return null; @@ -90,8 +86,7 @@ public class CodanProblemCategory implements IProblemCategory, Cloneable { try { CodanProblemCategory clone = (CodanProblemCategory) super.clone(); clone.list = new ArrayList<IProblemElement>(); - for (Iterator<IProblemElement> iterator = this.list.iterator(); iterator - .hasNext();) { + for (Iterator<IProblemElement> iterator = this.list.iterator(); iterator.hasNext();) { IProblemElement child = iterator.next(); clone.list.add((IProblemElement) child.clone()); } |