Changeset 3545
- Timestamp:
- Jul 2, 2007, 3:45:01 PM (16 years ago)
- Location:
- trunk/src/plugins/core/net/sf/basedb/plugins
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plugins/core/net/sf/basedb/plugins/Base1PluginExecuter.java
r3505 r3545 93 93 import java.net.URL; 94 94 import java.sql.SQLException; 95 import java.util.AbstractSet; 95 96 import java.util.ArrayList; 96 97 import java.util.Arrays; … … 104 105 import java.util.Map; 105 106 import java.util.Set; 107 import java.util.TreeMap; 106 108 import java.util.regex.Matcher; 107 109 import java.util.regex.Pattern; … … 744 746 Boolean mergeReporters = (Boolean) configuration.getValue(geneAveragesParameter.getName()); 745 747 746 Map<String, String> parameters = new HashMap<String, String>();748 ListMap<String, String> parameters = new ListMap<String, String>(); 747 749 for (PluginParameter<?> pp : getJobParametersFromXML(String.valueOf(configuration.getValue(jobParametersParameter.getName())))) 748 750 { … … 908 910 try 909 911 { 910 List<PluginParameter<?>> p = new ArrayList<PluginParameter<?>>();911 912 String doctype = "<!DOCTYPE jobparameters SYSTEM \"base1-plugin-configuration-file.dtd\">"; 912 913 Document doc = XMLUtil.getValidatedXml(doctype+xml, dtdFile); … … 923 924 } 924 925 }); 926 927 TreeMap<Integer, PluginParameter<?>> positionParameter = new TreeMap<Integer, PluginParameter<?>>(); 925 928 while (it.hasNext()) 926 929 { 927 930 Element e = it.next(); 928 931 JobParameter jp = new JobParameter(e); 929 p.add(jp.getPluginParameter()); 930 } 931 return p; 932 if (positionParameter.containsKey(jp.getPosition())) 933 { 934 throw new BaseException("Duplicate parameter at position "+jp.getPosition()); 935 } 936 positionParameter.put(jp.getPosition(), jp.getPluginParameter()); 937 } 938 return new ArrayList<PluginParameter<?>>(positionParameter.values()); 932 939 } 933 940 catch (JDOMException e1) … … 1430 1437 1431 1438 // int2 = 10^a / 2^(0.5*m) 1432 // int1 = int2 1439 // int1 = int2 * 2^m 1433 1440 intensities[1] = new Float(Math.pow(10, a) / Math.pow(2, 0.5 * m)); 1434 intensities[0] = new Float(intensities[1] 1441 intensities[0] = new Float(intensities[1] * Math.pow(2, m)); 1435 1442 } 1436 1443 … … 1848 1855 } 1849 1856 } 1857 1858 private class ListMap<K, V> extends java.util.AbstractMap<K, V> 1859 { 1860 private List<K> keys = new ArrayList<K>(); 1861 private List<V> values = new ArrayList<V>(); 1862 1863 @Override 1864 public Set<java.util.Map.Entry<K, V>> entrySet() 1865 { 1866 throw new UnsupportedOperationException(); 1867 } 1868 1869 @Override 1870 public V put(K key, V value) 1871 { 1872 V ret = null; 1873 int index = keys.indexOf(key); 1874 if (index == -1) 1875 { 1876 keys.add(key); 1877 values.add(value); 1878 } 1879 else 1880 { 1881 keys.set(index, key); 1882 ret = values.set(index, value); 1883 } 1884 return ret; 1885 } 1886 1887 @Override 1888 public V get(Object key) 1889 { 1890 if (key == null) throw new NullPointerException(); 1891 int index = keys.indexOf(key); 1892 V ret = null; 1893 if (index != -1) 1894 { 1895 ret = values.get(index); 1896 } 1897 return ret; 1898 } 1899 1900 @Override 1901 public boolean isEmpty() 1902 { 1903 return keys.isEmpty(); 1904 } 1905 1906 @Override 1907 public Set<K> keySet() 1908 { 1909 return new AbstractSet<K>() 1910 { 1911 @Override 1912 public Iterator<K> iterator() 1913 { 1914 return Collections.unmodifiableList(keys).iterator(); 1915 } 1916 1917 @Override 1918 public int size() 1919 { 1920 return keys.size(); 1921 } 1922 }; 1923 } 1924 1925 } 1850 1926 1851 1927 private enum Base1JobParameterType -
trunk/src/plugins/core/net/sf/basedb/plugins/BioAssaySetExporter.java
r3509 r3545 302 302 } 303 303 304 305 304 private void exportBaseFileSectionAssays(PrintWriter out, DbControl dc, BioAssaySet bas) 306 305 { … … 329 328 } 330 329 331 332 330 private void exportBaseFileSectionHead(PrintWriter out, Map<String, String> parameters) 333 331 { 334 332 out.println("BASEfile"); 333 335 334 if (!parameters.isEmpty()) 336 335 { 337 Set<String> keys = new HashSet<String>(parameters.keySet());338 if ( keys.remove("section"))336 List<String> keys = new ArrayList<String>(parameters.keySet()); 337 if ("section".equals(keys.get(0))) 339 338 { 340 339 out.println("section\t"+parameters.get("section")); 340 keys = keys.subList(1, keys.size()); 341 } 342 if (keys.contains("section")) 343 { 344 throw new BaseException("The parameters can't have a parameter 'section' in the middle of the list."); 341 345 } 342 346 for (String key : keys) … … 1025 1029 1026 1030 1031 @Override 1027 1032 public Plugin.MainType getMainType() 1028 1033 { … … 1092 1097 private DbControl dc; 1093 1098 private BioAssaySet bas; 1099 @Override 1094 1100 protected void begin(DbControl dc) 1095 1101 { … … 1097 1103 } 1098 1104 1105 @Override 1099 1106 @SuppressWarnings("unchecked") 1100 1107 protected void performExport(ExportOutputStream out, ProgressReporter progress) … … 1150 1157 } 1151 1158 1159 @Override 1152 1160 protected void end(boolean success) 1153 1161 { 1154 1162 this.dc = null; 1155 1163 } 1164 1165 @Override 1156 1166 protected String getSuccessMessage() 1157 1167 { 1158 1168 return "Bioassay set '" + bas.getName() + "' exported successfully"; 1159 1169 } 1160 1161 1170 1162 1171 @Override
Note: See TracChangeset
for help on using the changeset viewer.