Changeset 4117


Ignore:
Timestamp:
06/16/08 13:45:26 (11 years ago)
Author:
melissa
Message:

Changed signatures for set*Ref and get*Ref - instead of setting/getting the referenced node's index, we now set/get the referenced node's ID.

Location:
trunk/loci/formats
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/auto/OMEXMLMetadata.vm

    r4112 r4117  
    3232package loci.formats.ome; 
    3333 
     34import ome.xml.OMEXMLNode; 
    3435import ${q.basePackage()}.ome.*; 
    3536#if ($q.spwImport()) 
     
    112113    #set ($refName = $prop.replaceAll('Ref', '')) 
    113114    ${refName}Node node = ${lastVar}.get${refName}(); 
    114     OMENode ome = (OMENode) root; 
    115     List list = ome.get${refName}List(); 
    116     for (int i=0; i<list.size(); i++) { 
    117       Object o = list.get(i); 
    118       if (o.equals(node)) return new Integer(i); 
    119     } 
    120     return null; 
     115    if (node == null) return null; 
     116    return node.getNodeID(); 
    121117  #else   
    122118    return $lastVar == null ? null : $q.getter($lastVar); 
     
    170166  #if ($prop.endsWith("Ref")) 
    171167    #set ($refName = $prop.replaceAll('Ref', '')) 
    172     ${refName}Node node = get${refName}Node(${varName}.intValue(), true); 
     168    OMENode ome = (OMENode) root; 
     169    List list = ome.get${refName}List(); 
     170    ${refName}Node node = null; 
     171    for (int i=0; i<list.size(); i++) { 
     172      OMEXMLNode o = (OMEXMLNode) list.get(i); 
     173      if (o.getNodeID().equals($varName)) node = (${refName}Node) o; 
     174    } 
     175    if (node == null) { 
     176      node = new ${refName}Node(ome); 
     177      node.setNodeID($varName); 
     178    } 
    173179    ${prop}Node ref = new ${prop}Node(${lastVar}Node); 
    174180    ref.set${refName}Node(node); 
  • trunk/loci/formats/auto/entities.txt

    r4112 r4117  
    5454 
    5555[Image InstrumentRef] 
    56 type = Integer 
     56type = String  
    5757description = TODO 
    5858 
  • trunk/loci/formats/meta/AggregateMetadata.java

    r4112 r4117  
    2525 * 
    2626 * THIS IS AUTOMATICALLY GENERATED CODE.  DO NOT MODIFY. 
    27  * Created by melissa via MetadataAutogen on Jun 12, 2008 10:39:37 PM CDT 
     27 * Created by melissa via MetadataAutogen on Jun 16, 2008 1:24:43 PM PDT 
    2828 * 
    2929 *----------------------------------------------------------------------------- 
     
    847847 
    848848  /* @see MetadataRetrieve#getImageInstrumentRef(int) */ 
    849   public Integer getImageInstrumentRef(int imageIndex) { 
    850     for (Iterator iter = delegates.iterator(); iter.hasNext();) { 
    851       Object o = iter.next(); 
    852       if (o instanceof MetadataRetrieve) { 
    853         MetadataRetrieve retrieve = (MetadataRetrieve) o; 
    854         Integer result = retrieve.getImageInstrumentRef(imageIndex); 
     849  public String getImageInstrumentRef(int imageIndex) { 
     850    for (Iterator iter = delegates.iterator(); iter.hasNext();) { 
     851      Object o = iter.next(); 
     852      if (o instanceof MetadataRetrieve) { 
     853        MetadataRetrieve retrieve = (MetadataRetrieve) o; 
     854        String result = retrieve.getImageInstrumentRef(imageIndex); 
    855855        if (result != null) return result; 
    856856      } 
     
    28452845  } 
    28462846 
    2847   /* @see MetadataStore#setImageInstrumentRef(Integer, int) */ 
    2848   public void setImageInstrumentRef(Integer instrumentRef, int imageIndex) { 
     2847  /* @see MetadataStore#setImageInstrumentRef(String, int) */ 
     2848  public void setImageInstrumentRef(String instrumentRef, int imageIndex) { 
    28492849    for (Iterator iter = delegates.iterator(); iter.hasNext();) { 
    28502850      Object o = iter.next(); 
  • trunk/loci/formats/meta/DummyMetadata.java

    r4112 r4117  
    2525 * 
    2626 * THIS IS AUTOMATICALLY GENERATED CODE.  DO NOT MODIFY. 
    27  * Created by melissa via MetadataAutogen on Jun 12, 2008 10:39:37 PM CDT 
     27 * Created by melissa via MetadataAutogen on Jun 16, 2008 1:24:43 PM PDT 
    2828 * 
    2929 *----------------------------------------------------------------------------- 
     
    330330  } 
    331331  /* @see MetadataRetrieve#getImageInstrumentRef(int) */ 
    332   public Integer getImageInstrumentRef(int imageIndex) { 
     332  public String getImageInstrumentRef(int imageIndex) { 
    333333    return null; 
    334334  } 
     
    10411041  } 
    10421042 
    1043   /* @see MetadataStore#setImageInstrumentRef(Integer, int) */ 
    1044   public void setImageInstrumentRef(Integer instrumentRef, int imageIndex) { 
     1043  /* @see MetadataStore#setImageInstrumentRef(String, int) */ 
     1044  public void setImageInstrumentRef(String instrumentRef, int imageIndex) { 
    10451045  } 
    10461046 
  • trunk/loci/formats/meta/FilterMetadata.java

    r4112 r4117  
    2525 * 
    2626 * THIS IS AUTOMATICALLY GENERATED CODE.  DO NOT MODIFY. 
    27  * Created by melissa via MetadataAutogen on Jun 12, 2008 10:39:37 PM CDT 
     27 * Created by melissa via MetadataAutogen on Jun 16, 2008 1:24:43 PM PDT 
    2828 * 
    2929 *----------------------------------------------------------------------------- 
     
    297297  } 
    298298 
    299   /* @see MetadataStore#setImageInstrumentRef(Integer, int) */ 
    300   public void setImageInstrumentRef(Integer instrumentRef, int imageIndex) { 
    301     store.setImageInstrumentRef(instrumentRef, imageIndex); 
     299  /* @see MetadataStore#setImageInstrumentRef(String, int) */ 
     300  public void setImageInstrumentRef(String instrumentRef, int imageIndex) { 
     301    String value = filter ? DataTools.sanitize(instrumentRef) : instrumentRef; 
     302    store.setImageInstrumentRef(value, imageIndex); 
    302303  } 
    303304 
  • trunk/loci/formats/meta/MetadataConverter.java

    r4112 r4117  
    2525 * 
    2626 * THIS IS AUTOMATICALLY GENERATED CODE.  DO NOT MODIFY. 
    27  * Created by melissa via MetadataAutogen on Jun 12, 2008 10:39:37 PM CDT 
     27 * Created by melissa via MetadataAutogen on Jun 16, 2008 1:24:43 PM PDT 
    2828 * 
    2929 *----------------------------------------------------------------------------- 
     
    8080      String imageIDValue = src.getImageID(imageIndex); 
    8181      if (imageIDValue != null) dest.setImageID(imageIDValue, imageIndex); 
    82       Integer imageInstrumentRefValue = src.getImageInstrumentRef(imageIndex); 
     82      String imageInstrumentRefValue = src.getImageInstrumentRef(imageIndex); 
    8383      if (imageInstrumentRefValue != null) dest.setImageInstrumentRef(imageInstrumentRefValue, imageIndex); 
    8484      String imageNameValue = src.getImageName(imageIndex); 
  • trunk/loci/formats/meta/MetadataRetrieve.java

    r4112 r4117  
    2525 * 
    2626 * THIS IS AUTOMATICALLY GENERATED CODE.  DO NOT MODIFY. 
    27  * Created by melissa via MetadataAutogen on Jun 12, 2008 10:39:37 PM CDT 
     27 * Created by melissa via MetadataAutogen on Jun 16, 2008 1:24:43 PM PDT 
    2828 * 
    2929 *----------------------------------------------------------------------------- 
     
    350350   * @param imageIndex index of the Image 
    351351   */ 
    352   Integer getImageInstrumentRef(int imageIndex); 
     352  String getImageInstrumentRef(int imageIndex); 
    353353 
    354354  /** 
  • trunk/loci/formats/meta/MetadataStore.java

    r4112 r4117  
    2525 * 
    2626 * THIS IS AUTOMATICALLY GENERATED CODE.  DO NOT MODIFY. 
    27  * Created by melissa via MetadataAutogen on Jun 12, 2008 10:39:37 PM CDT 
     27 * Created by melissa via MetadataAutogen on Jun 16, 2008 1:24:43 PM PDT 
    2828 * 
    2929 *----------------------------------------------------------------------------- 
     
    367367   * @param imageIndex index of the Image 
    368368   */ 
    369   void setImageInstrumentRef(Integer instrumentRef, int imageIndex); 
     369  void setImageInstrumentRef(String instrumentRef, int imageIndex); 
    370370 
    371371  /** 
  • trunk/loci/formats/ome/OMEXML2003FCMetadata.java

    r4112 r4117  
    2525 * 
    2626 * THIS IS AUTOMATICALLY GENERATED CODE.  DO NOT MODIFY. 
    27  * Created by melissa via MetadataAutogen on Jun 12, 2008 10:39:37 PM CDT 
     27 * Created by melissa via MetadataAutogen on Jun 16, 2008 1:24:43 PM PDT 
    2828 * 
    2929 *----------------------------------------------------------------------------- 
     
    3232package loci.formats.ome; 
    3333 
     34import ome.xml.OMEXMLNode; 
    3435import ome.xml.r2003fc.ome.*; 
    3536import java.util.List; 
     
    449450 
    450451  /* @see loci.formats.meta.MetadataRetrieve#getImageInstrumentRef(int) */ 
    451   public Integer getImageInstrumentRef(int imageIndex) { 
     452  public String getImageInstrumentRef(int imageIndex) { 
    452453    ImageNode image = getImageNode(imageIndex, false); 
    453454      InstrumentNode node = image.getInstrument(); 
    454     OMENode ome = (OMENode) root; 
    455     List list = ome.getInstrumentList(); 
    456     for (int i=0; i<list.size(); i++) { 
    457       Object o = list.get(i); 
    458       if (o.equals(node)) return new Integer(i); 
    459     } 
    460     return null; 
     455    if (node == null) return null; 
     456    return node.getNodeID(); 
    461457    } 
    462458 
     
    14871483    } 
    14881484 
    1489   /* @see loci.formats.meta.MetadataStore#setImageInstrumentRef(Integer, int) */ 
    1490   public void setImageInstrumentRef(Integer instrumentRef, int imageIndex) { 
     1485  /* @see loci.formats.meta.MetadataStore#setImageInstrumentRef(String, int) */ 
     1486  public void setImageInstrumentRef(String instrumentRef, int imageIndex) { 
    14911487    if (instrumentRef == null) return; 
    14921488    ImageNode imageNode = getImageNode(imageIndex, true); 
    1493       InstrumentNode node = getInstrumentNode(instrumentRef.intValue(), true); 
     1489      OMENode ome = (OMENode) root; 
     1490    List list = ome.getInstrumentList(); 
     1491    InstrumentNode node = null; 
     1492    for (int i=0; i<list.size(); i++) { 
     1493      OMEXMLNode o = (OMEXMLNode) list.get(i); 
     1494      if (o.getNodeID().equals(instrumentRef)) node = (InstrumentNode) o; 
     1495    } 
     1496    if (node == null) { 
     1497      node = new InstrumentNode(ome); 
     1498      node.setNodeID(instrumentRef); 
     1499    } 
    14941500    InstrumentRefNode ref = new InstrumentRefNode(imageNode); 
    14951501    ref.setInstrumentNode(node); 
  • trunk/loci/formats/ome/OMEXML200706Metadata.java

    r4112 r4117  
    2525 * 
    2626 * THIS IS AUTOMATICALLY GENERATED CODE.  DO NOT MODIFY. 
    27  * Created by melissa via MetadataAutogen on Jun 12, 2008 10:39:37 PM CDT 
     27 * Created by melissa via MetadataAutogen on Jun 16, 2008 1:24:43 PM PDT 
    2828 * 
    2929 *----------------------------------------------------------------------------- 
     
    3232package loci.formats.ome; 
    3333 
     34import ome.xml.OMEXMLNode; 
    3435import ome.xml.r200706.ome.*; 
    3536import ome.xml.r200706.spw.*; 
     
    466467 
    467468  /* @see loci.formats.meta.MetadataRetrieve#getImageInstrumentRef(int) */ 
    468   public Integer getImageInstrumentRef(int imageIndex) { 
     469  public String getImageInstrumentRef(int imageIndex) { 
    469470    ImageNode image = getImageNode(imageIndex, false); 
    470471      InstrumentNode node = image.getInstrument(); 
    471     OMENode ome = (OMENode) root; 
    472     List list = ome.getInstrumentList(); 
    473     for (int i=0; i<list.size(); i++) { 
    474       Object o = list.get(i); 
    475       if (o.equals(node)) return new Integer(i); 
    476     } 
    477     return null; 
     472    if (node == null) return null; 
     473    return node.getNodeID(); 
    478474    } 
    479475 
     
    15041500    } 
    15051501 
    1506   /* @see loci.formats.meta.MetadataStore#setImageInstrumentRef(Integer, int) */ 
    1507   public void setImageInstrumentRef(Integer instrumentRef, int imageIndex) { 
     1502  /* @see loci.formats.meta.MetadataStore#setImageInstrumentRef(String, int) */ 
     1503  public void setImageInstrumentRef(String instrumentRef, int imageIndex) { 
    15081504    if (instrumentRef == null) return; 
    15091505    ImageNode imageNode = getImageNode(imageIndex, true); 
    1510       InstrumentNode node = getInstrumentNode(instrumentRef.intValue(), true); 
     1506      OMENode ome = (OMENode) root; 
     1507    List list = ome.getInstrumentList(); 
     1508    InstrumentNode node = null; 
     1509    for (int i=0; i<list.size(); i++) { 
     1510      OMEXMLNode o = (OMEXMLNode) list.get(i); 
     1511      if (o.getNodeID().equals(instrumentRef)) node = (InstrumentNode) o; 
     1512    } 
     1513    if (node == null) { 
     1514      node = new InstrumentNode(ome); 
     1515      node.setNodeID(instrumentRef); 
     1516    } 
    15111517    InstrumentRefNode ref = new InstrumentRefNode(imageNode); 
    15121518    ref.setInstrumentNode(node); 
  • trunk/loci/formats/ome/OMEXML200802Metadata.java

    r4112 r4117  
    2525 * 
    2626 * THIS IS AUTOMATICALLY GENERATED CODE.  DO NOT MODIFY. 
    27  * Created by melissa via MetadataAutogen on Jun 12, 2008 10:39:37 PM CDT 
     27 * Created by melissa via MetadataAutogen on Jun 16, 2008 1:24:43 PM PDT 
    2828 * 
    2929 *----------------------------------------------------------------------------- 
     
    3232package loci.formats.ome; 
    3333 
     34import ome.xml.OMEXMLNode; 
    3435import ome.xml.r200802.ome.*; 
    3536import ome.xml.r200802.spw.*; 
     
    466467 
    467468  /* @see loci.formats.meta.MetadataRetrieve#getImageInstrumentRef(int) */ 
    468   public Integer getImageInstrumentRef(int imageIndex) { 
     469  public String getImageInstrumentRef(int imageIndex) { 
    469470    ImageNode image = getImageNode(imageIndex, false); 
    470471      InstrumentNode node = image.getInstrument(); 
    471     OMENode ome = (OMENode) root; 
    472     List list = ome.getInstrumentList(); 
    473     for (int i=0; i<list.size(); i++) { 
    474       Object o = list.get(i); 
    475       if (o.equals(node)) return new Integer(i); 
    476     } 
    477     return null; 
     472    if (node == null) return null; 
     473    return node.getNodeID(); 
    478474    } 
    479475 
     
    15041500    } 
    15051501 
    1506   /* @see loci.formats.meta.MetadataStore#setImageInstrumentRef(Integer, int) */ 
    1507   public void setImageInstrumentRef(Integer instrumentRef, int imageIndex) { 
     1502  /* @see loci.formats.meta.MetadataStore#setImageInstrumentRef(String, int) */ 
     1503  public void setImageInstrumentRef(String instrumentRef, int imageIndex) { 
    15081504    if (instrumentRef == null) return; 
    15091505    ImageNode imageNode = getImageNode(imageIndex, true); 
    1510       InstrumentNode node = getInstrumentNode(instrumentRef.intValue(), true); 
     1506      OMENode ome = (OMENode) root; 
     1507    List list = ome.getInstrumentList(); 
     1508    InstrumentNode node = null; 
     1509    for (int i=0; i<list.size(); i++) { 
     1510      OMEXMLNode o = (OMEXMLNode) list.get(i); 
     1511      if (o.getNodeID().equals(instrumentRef)) node = (InstrumentNode) o; 
     1512    } 
     1513    if (node == null) { 
     1514      node = new InstrumentNode(ome); 
     1515      node.setNodeID(instrumentRef); 
     1516    } 
    15111517    InstrumentRefNode ref = new InstrumentRefNode(imageNode); 
    15121518    ref.setInstrumentNode(node); 
Note: See TracChangeset for help on using the changeset viewer.