Changeset 6010


Ignore:
Timestamp:
03/09/10 16:21:26 (10 years ago)
Author:
curtis
Message:

Add a method for merging metadata from one table to another.

Location:
trunk/components/bio-formats/src/loci/formats
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/bio-formats/src/loci/formats/FormatReader.java

    r5805 r6010  
    856856      } 
    857857      setSeries(series); 
    858       Hashtable seriesMetadata = getSeriesMetadata(); 
    859       Object[] keys = seriesMetadata.keySet().toArray(); 
    860       for (Object key : keys) { 
    861         h.put(name + " " + key, seriesMetadata.get(key)); 
    862       } 
     858      MetadataTools.merge(getSeriesMetadata(), h, name + " "); 
    863859    } 
    864860    setSeries(oldSeries); 
  • trunk/components/bio-formats/src/loci/formats/MetadataTools.java

    r5629 r6010  
    2727import java.util.Arrays; 
    2828import java.util.Hashtable; 
     29import java.util.Map; 
    2930 
    3031import javax.xml.parsers.ParserConfigurationException; 
     
    4849import org.w3c.dom.NodeList; 
    4950import org.xml.sax.SAXException; 
    50  
    5151 
    5252/** 
     
    629629  } 
    630630 
     631  /** 
     632   * Merges the given lists of metadata, prepending the 
     633   * specified prefix for the destination keys. 
     634   */ 
     635  public static void merge(Map src, Map dest, String prefix) { 
     636    for (Object key : src.keySet()) { 
     637      dest.put(prefix + key, src.get(key)); 
     638    } 
     639  } 
     640 
    631641  // -- Helper methods -- 
    632642 
Note: See TracChangeset for help on using the changeset viewer.