Permalink
Browse files

tabs->spaces

  • Loading branch information...
1 parent b90d131 commit 75676933c963939c9c52eae7c8f0d5cced288dc9 @wolfs committed Dec 13, 2010
@@ -44,73 +44,73 @@
* @author wolfs
*/
public class CalculateDeps {
- private static final Logger LOGGER = Logger.getLogger(CalculateDeps.class.getName());
- private final Set<Dependency> visitedDeps = new HashSet<Dependency>();
- private final Set<AbstractProject<?,?>> visitedProj = new HashSet<AbstractProject<?,?>>();
- private boolean calculated = false;
+ private static final Logger LOGGER = Logger.getLogger(CalculateDeps.class.getName());
+ private final Set<Dependency> visitedDeps = new HashSet<Dependency>();
+ private final Set<AbstractProject<?,?>> visitedProj = new HashSet<AbstractProject<?,?>>();
+ private boolean calculated = false;
- public CalculateDeps(Collection<? extends AbstractProject<?, ?>> projects) {
- visitedProj.addAll(projects);
- }
+ public CalculateDeps(Collection<? extends AbstractProject<?, ?>> projects) {
+ visitedProj.addAll(projects);
+ }
- public void calculateNodesAndDependencies() {
- if (!calculated) {
- calculateNodesAndDependencies(visitedProj);
- calculated = true;
- }
- }
+ public void calculateNodesAndDependencies() {
+ if (!calculated) {
+ calculateNodesAndDependencies(visitedProj);
+ calculated = true;
+ }
+ }
- private void calculateNodesAndDependencies(Set<AbstractProject<?, ?>> fromProjects) {
- Set<AbstractProject<?,?>> newProj = new HashSet<AbstractProject<?, ?>>();
- DependencyGraph depGraph = Hudson.getInstance().getDependencyGraph();
- for (AbstractProject<?,?> project : fromProjects) {
- if (project.hasPermission(Item.READ)) {
- newProj.addAll(
- addNewDependencies(depGraph.getUpstreamDependencies(project),true));
- newProj.addAll(
- addNewDependencies(depGraph.getDownstreamDependencies(project),false));
- }
- }
- visitedProj.addAll(newProj);
- if (!newProj.isEmpty()) {
- calculateNodesAndDependencies(newProj);
- }
- }
+ private void calculateNodesAndDependencies(Set<AbstractProject<?, ?>> fromProjects) {
+ Set<AbstractProject<?,?>> newProj = new HashSet<AbstractProject<?, ?>>();
+ DependencyGraph depGraph = Hudson.getInstance().getDependencyGraph();
+ for (AbstractProject<?,?> project : fromProjects) {
+ if (project.hasPermission(Item.READ)) {
+ newProj.addAll(
+ addNewDependencies(depGraph.getUpstreamDependencies(project),true));
+ newProj.addAll(
+ addNewDependencies(depGraph.getDownstreamDependencies(project),false));
+ }
+ }
+ visitedProj.addAll(newProj);
+ if (!newProj.isEmpty()) {
+ calculateNodesAndDependencies(newProj);
+ }
+ }
- private Set<AbstractProject<?, ?>> addNewDependencies(Collection<Dependency> dependencies, boolean isUpstream) {
- Set<AbstractProject<?,?>> newProj = new HashSet<AbstractProject<?, ?>>();
- for (Dependency dep : dependencies) {
- AbstractProject<?,?> projectToAdd = isUpstream ? dep.getUpstreamProject() : dep.getDownstreamProject();
- if (projectToAdd.hasPermission(Item.READ) && !visitedDeps.contains(dep)) {
- visitedDeps.add(dep);
- if (!visitedProj.contains(projectToAdd)) {
- newProj.add(projectToAdd);
- }
- }
- }
- return newProj;
- }
+ private Set<AbstractProject<?, ?>> addNewDependencies(Collection<Dependency> dependencies, boolean isUpstream) {
+ Set<AbstractProject<?,?>> newProj = new HashSet<AbstractProject<?, ?>>();
+ for (Dependency dep : dependencies) {
+ AbstractProject<?,?> projectToAdd = isUpstream ? dep.getUpstreamProject() : dep.getDownstreamProject();
+ if (projectToAdd.hasPermission(Item.READ) && !visitedDeps.contains(dep)) {
+ visitedDeps.add(dep);
+ if (!visitedProj.contains(projectToAdd)) {
+ newProj.add(projectToAdd);
+ }
+ }
+ }
+ return newProj;
+ }
/**
* Calculates the connected components if necessary
* @return projects (nodes) in the connected components
*/
- public Set<AbstractProject<?, ?>> getProjects() {
- if (!calculated) {
- calculateNodesAndDependencies();
- }
- return Collections.unmodifiableSet(visitedProj);
- }
+ public Set<AbstractProject<?, ?>> getProjects() {
+ if (!calculated) {
+ calculateNodesAndDependencies();
+ }
+ return Collections.unmodifiableSet(visitedProj);
+ }
/**
* Calculates the connected components if necessary
* @return dependencies (edges) in the connected components
*/
- public Set<Dependency> getDependencies() {
- if (!calculated) {
- calculateNodesAndDependencies();
- }
- return Collections.unmodifiableSet(visitedDeps);
- }
+ public Set<Dependency> getDependencies() {
+ if (!calculated) {
+ calculateNodesAndDependencies();
+ }
+ return Collections.unmodifiableSet(visitedDeps);
+ }
}
@@ -41,56 +41,56 @@
*/
public class DependencyGraphProperty extends AbstractDescribableImpl<DependencyGraphProperty> {
- @DataBoundConstructor
- public DependencyGraphProperty() {
- }
+ @DataBoundConstructor
+ public DependencyGraphProperty() {
+ }
- @Extension
- public static class DescriptorImpl extends Descriptor<DependencyGraphProperty> {
+ @Extension
+ public static class DescriptorImpl extends Descriptor<DependencyGraphProperty> {
- private String dotExe;
+ private String dotExe;
- public DescriptorImpl() {
- load();
- }
+ public DescriptorImpl() {
+ load();
+ }
- @Override
+ @Override
public boolean configure( StaplerRequest req, JSONObject o ) {
- dotExe = Util.fixEmptyAndTrim(o.getString("dotExe"));
+ dotExe = Util.fixEmptyAndTrim(o.getString("dotExe"));
save();
return true;
}
- @Override
- public String getDisplayName() {
- return Messages.DependencyGraphProperty_DependencyGraphViewer();
- }
+ @Override
+ public String getDisplayName() {
+ return Messages.DependencyGraphProperty_DependencyGraphViewer();
+ }
- public String getDotExe() {
- return dotExe;
- }
+ public String getDotExe() {
+ return dotExe;
+ }
/**
* @return configured dot executable or a default
*/
- public String getDotExeOrDefault() {
- if (Util.fixEmptyAndTrim(dotExe) == null) {
- return Functions.isWindows() ? "dot.exe" : "dot";
- } else {
- return dotExe;
- }
- }
-
- public synchronized void setDotExe(String dotPath) {
- this.dotExe = dotPath;
- save();
- }
-
- public FormValidation doCheckDotExe(@QueryParameter final String value) {
- return FormValidation.validateExecutable(value);
- }
-
- }
+ public String getDotExeOrDefault() {
+ if (Util.fixEmptyAndTrim(dotExe) == null) {
+ return Functions.isWindows() ? "dot.exe" : "dot";
+ } else {
+ return dotExe;
+ }
+ }
+
+ public synchronized void setDotExe(String dotPath) {
+ this.dotExe = dotPath;
+ save();
+ }
+
+ public FormValidation doCheckDotExe(@QueryParameter final String value) {
+ return FormValidation.validateExecutable(value);
+ }
+
+ }
}
@@ -41,7 +41,7 @@
* Shows the connected components containing the projects of the view
*/
public static class DependencyGraphViewAction extends AbstractDependencyGraphAction
- implements Action {
+ implements Action {
private View view;

0 comments on commit 7567693

Please sign in to comment.