]> git.gag.com Git - debian/openrocket/commitdiff
Added alternative query arguments for listForTypes which takes a list instead of...
authorkruland2607 <kruland2607@180e2498-e6e9-4542-8430-84ac67f01cd8>
Thu, 19 Apr 2012 16:04:33 +0000 (16:04 +0000)
committerkruland2607 <kruland2607@180e2498-e6e9-4542-8430-84ac67f01cd8>
Thu, 19 Apr 2012 16:04:33 +0000 (16:04 +0000)
git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/trunk@572 180e2498-e6e9-4542-8430-84ac67f01cd8

core/src/net/sf/openrocket/database/ComponentPresetDao.java
core/src/net/sf/openrocket/database/ComponentPresetDatabase.java

index 8d79967f3c42b4c681b30fa2292939e9b6da42da..4984caebbab2c1b7092aec7c3932c8219ec13aa5 100644 (file)
@@ -23,6 +23,8 @@ public interface ComponentPresetDao {
        public List<ComponentPreset> listForType( ComponentPreset.Type type, boolean favorite );
 
        public List<ComponentPreset> listForTypes( ComponentPreset.Type ... type );
+       
+       public List<ComponentPreset> listForTypes( List<ComponentPreset.Type> types );
 
        public void setFavorite( ComponentPreset preset, boolean favorite );
        
index d7cab153e20a80f3a4f5e57f3e04f36896cdfb9b..6ff12ceabdc99040e3586a7cd8a5878ffd5acc0a 100644 (file)
@@ -124,7 +124,7 @@ public class ComponentPresetDatabase extends Database<ComponentPreset> implement
                for( ComponentPreset preset : list ) {
                        ComponentPreset.Type presetType = preset.get(ComponentPreset.TYPE);
                        typeLoop: for( int i=0; i<type.length; i++ ) {
-                               if ( !presetType.equals(type) ) {
+                               if ( presetType.equals(type[i]) ) {
                                        result.add(preset);
                                        break typeLoop; // from inner loop.
                                }
@@ -134,6 +134,11 @@ public class ComponentPresetDatabase extends Database<ComponentPreset> implement
                return result;
        }
 
+       @Override
+       public List<ComponentPreset> listForTypes( List<ComponentPreset.Type> types ) {
+               return listForTypes( (ComponentPreset.Type[]) types.toArray() );
+       }
+       
        @Override
        public List<ComponentPreset> find(String manufacturer, String partNo) {
                List<ComponentPreset> presets = new ArrayList<ComponentPreset>();