From a6ded1d9de7053808243a9ffae59ded2db75cef0 Mon Sep 17 00:00:00 2001 From: ervandew Date: Thu, 11 Feb 2010 18:49:00 -0800 Subject: [PATCH] add hasDependency method to Feature --- .../formic/wizard/step/shared/Feature.java | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/java/org/formic/wizard/step/shared/Feature.java b/src/java/org/formic/wizard/step/shared/Feature.java index 67d391d..7900f21 100644 --- a/src/java/org/formic/wizard/step/shared/Feature.java +++ b/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 @@ -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. *