Skip to content

Commit

Permalink
add hasDependency method to Feature
Browse files Browse the repository at this point in the history
  • Loading branch information
ervandew committed Feb 12, 2010
1 parent f318de4 commit a6ded1d
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/java/org/formic/wizard/step/shared/Feature.java
@@ -1,6 +1,6 @@
/**
* Formic installer framework.
* Copyright (C) 2005 - 2008 Eric Van Dewoestine
* Copyright (C) 2005 - 2010 Eric Van Dewoestine
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -117,6 +117,26 @@ public void setDependencies(String[] dependencies)
this.dependencies = dependencies;
}

/**
* Determines if this feature has the supplied feature as a dependency.
*
* @param name The key of the feature.
* @return True if the feature is a dependency, false otherwise.
*/
public boolean hasDependency(String key)
{
if (dependencies == null || key == null){
return false;
}

for(int ii = 0; ii < dependencies.length; ii++){
if (dependencies[ii].equals(key)){
return true;
}
}
return false;
}

/**
* Gets the info for this instance.
*
Expand Down

0 comments on commit a6ded1d

Please sign in to comment.