Changeset 3980


Ignore:
Timestamp:
04/24/08 16:41:12 (12 years ago)
Author:
curtis
Message:

Fix node creation logic.

File:
1 edited

Legend:

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

    r3977 r3980  
    186186    if ($nodeVar == null) return null; 
    187187#end##if $vars == "" 
    188     // get $last node 
    189188#if ($multi) 
     189    // get $last+ node 
    190190    int count = ${nodeVar}.get${last}Count(); 
    191     if (!create && count >= ${lastVar}Index) return null; 
     191    if (!create && count <= ${lastVar}Index) return null; 
    192192    for (int i=count; i<=${lastVar}Index; i++) new ${last}Node($nodeVar); 
    193193    List list = ${nodeVar}.get${last}List(); 
    194194    return (${last}Node) list.get(${lastVar}Index); 
    195195#else 
    196     return ${nodeVar}.get$last(); 
     196    // get $last node 
     197    ${last}Node $lastVar = ${nodeVar}.get$last(); 
     198    if ($lastVar == null) { 
     199      if (create) $lastVar = new ${last}Node($nodeVar); 
     200      else return null; 
     201    } 
     202    return $lastVar; 
    197203#end##if $multi 
    198204  } 
Note: See TracChangeset for help on using the changeset viewer.