コード例 #1
0
 private static boolean isFeaturePatch(IFeature feature) {
   IFeatureImport[] imports = feature.getImports();
   for (int i = 0; i < imports.length; i++) {
     if (imports[i].isPatch()) return true;
   }
   return false;
 }
コード例 #2
0
 /**
  * Recursively gets the ID of required features of this feature and adds them to the list
  *
  * @param model feature model to get requirements of
  * @param requiredFeatureList collector for the required features
  */
 private void getFeatureDependencies(
     IFeatureModel model, IFeatureModel[] allFeatures, ArrayList requiredFeatureList) {
   IFeature feature = model.getFeature();
   IFeatureImport[] featureImports = feature.getImports();
   for (int i = 0; i < featureImports.length; i++) {
     if (featureImports[i].getType() == IFeatureImport.FEATURE) {
       for (int j = 0; j < allFeatures.length; j++) {
         if (allFeatures[j].getFeature().getId().equals(featureImports[i].getId())) {
           requiredFeatureList.add(allFeatures[j]);
           getFeatureDependencies(allFeatures[j], allFeatures, requiredFeatureList);
           break;
         }
       }
     }
   }
   IFeatureChild[] featureIncludes = feature.getIncludedFeatures();
   for (int i = 0; i < featureIncludes.length; i++) {
     requiredFeatureList.add(featureIncludes[i].getId());
     for (int j = 0; j < allFeatures.length; j++) {
       if (allFeatures[j].getFeature().getId().equals(featureIncludes[i].getId())) {
         requiredFeatureList.add(allFeatures[j]);
         getFeatureDependencies(allFeatures[j], allFeatures, requiredFeatureList);
         break;
       }
     }
   }
 }