diff m-toolbox/classes/+utils/@helper/isSubmissionPlist.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/classes/+utils/@helper/isSubmissionPlist.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,71 @@
+% ISSUBMISSIONPLIST Checks if the input plist is a submission plist.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% DESCRIPTION: ISSUBMISSIONPLIST Checks if the input plist is a submission
+%              plist. This means that this method checks that the input
+%              plist have only some of the following keys:
+%              'hostname'
+%              'database'
+%              'username'
+%              'password'
+%              'experiment title'
+%              'experiment description'
+%              'analysis description'
+%              'quantity'
+%              'keywords'
+%              'reference ids'
+%              'additional comments'
+%              'additional authors'
+%              'binary'
+%              'no dialog'
+%
+% CALL:        res = isSubmissionPlist(pl)
+%
+% VERSION:     $Id: isSubmissionPlist.m,v 1.6 2010/05/03 19:21:52 ingo Exp $
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+function res = isSubmissionPlist(pl)
+  
+  fields = {...
+    'hostname', ...
+    'database', ...
+    'username', ...
+    'password', ...
+    'conn',     ...
+    'experiment title', ...
+    'experiment_title', ...
+    'experiment description', ...
+    'experiment_description', ...
+    'analysis description', ...
+    'analysis_description', ...
+    'quantity', ...
+    'keywords', ...
+    'reference ids', ...
+    'reference_ids', ...
+    'additional comments', ...
+    'additional_comments', ...
+    'additional authors', ...
+    'additional_authors', ...
+    'binary', ...
+    'sinfo filename', ...
+    'sinfo_filename', ...
+    'no dialog', ...
+    'use selector'};
+  
+  if pl.nparams >= 1
+    keys = lower({pl.params(:).key});
+    
+    res = utils.helper.ismember(keys, fields);
+    
+    if all(res)
+      res = true;
+    else
+      res = false;
+    end
+    
+  else
+    res = false;
+  end
+  
+end