Ignore:
Timestamp:
04/11/08 15:56:39 (12 years ago)
Author:
curtis
Message:

A bunch of work on the loci.formats.meta autogenerator. Not finished yet.

File:
1 edited

Legend:

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

    r3605 r3917  
    3333package loci.formats.ome; 
    3434 
    35 #if ($legacy == "true") 
     35#if ($q.legacy()) 
    3636import $basePackage.*; 
    37 #end##$legacy 
    38 import $basePackage.$subPackage.*; 
     37#end##if legacy 
     38import $q.basePackage().$q.subPackage().*; 
    3939import java.util.List; 
    4040import loci.formats.LogTools; 
     
    4242/** 
    4343 * A metadata store implementation for constructing and manipulating OME-XML 
    44  * DOMs for the $version version of OME-XML. It requires the 
    45  * $basePackage package to compile (part of ome-java.jar). 
     44 * DOMs for the $q.version() version of OME-XML. It requires the 
     45 * $q.basePackage() package to compile (part of ome-java.jar). 
    4646 * 
    4747 * <dl><dt><b>Source code:</b></dt> 
    48  * <dd><a href="https://skyking.microscopy.wisc.edu/trac/java/browser/trunk/loci/formats/ome/$id">Trac</a>, 
    49  * <a href="https://skyking.microscopy.wisc.edu/svn/java/trunk/loci/formats/ome/$id">SVN</a></dd></dl> 
     48 * <dd><a href="https://skyking.microscopy.wisc.edu/trac/java/browser/trunk/loci/formats/ome/$q.id()">Trac</a>, 
     49 * <a href="https://skyking.microscopy.wisc.edu/svn/java/trunk/loci/formats/ome/$q.id()">SVN</a></dd></dl> 
    5050 * 
    5151 * @author Curtis Rueden ctrueden at wisc.edu 
    5252 * @author Melissa Linkert linkert at wisc.edu 
    5353 */ 
    54 public class $class extends OMEXMLMetadata { 
     54public class $q.className() extends OMEXMLMetadata { 
    5555 
    5656  // -- OMEXMLMetadata API methods -- 
     
    5959  public String dumpXML() { 
    6060    if (root == null) return null; 
    61 #if ($legacy == "true") 
     61#if ($q.legacy()) 
    6262    try { return ((OMENode) root).writeOME(false); } 
    6363    catch (javax.xml.transform.TransformerException exc) { 
     
    8080    } 
    8181    return null; 
    82 #end##if $legacy 
     82#end##if legacy 
    8383  } 
    8484 
     
    8686 
    8787  // - Entity counting - 
    88 #foreach ($entity in $entities) 
     88#foreach ($entity in $q.entities()) 
     89#set ($dummy = $q.setEntity($entity)) 
    8990#if ($entity.countable()) 
    90 #set ($last = $entity.last($versionKey)) 
     91#set ($last = $q.last()) 
    9192 
    9293  /* @see loci.formats.meta.MetadataRetrieve#get$entity.name()Count($entity.indicesList(true, false, false)) */ 
    9394  public int get$entity.name()Count($entity.indicesList(true, true, false)) { 
    94 #if ($last == "-") 
     95    return 0;//TEMP! 
     96#if ($q.path() == "-") 
    9597    // NB: $entity.name() unsupported for schema version $version 
    9698    return -1; 
    9799#else 
    98100    for (int i=0; i<Integer.MAX_VALUE; i++) { 
    99       if (get$entity.name()($entity.indicesList(false, true).replaceFirst("[a-zA-Z_0-9]+$", "i")) == null) return i; 
     101      if (get$entity($q.indicesList(false, true).replaceFirst("[a-zA-Z_0-9]+$", "i")) == null) return i; 
    100102    } 
    101103    return -1; 
     
    106108 
    107109  // - Entity retrieval - 
    108 #foreach ($entity in $entities) 
    109 #set ($last = $entity.last($versionKey)) 
    110  
    111   /* @see loci.formats.meta.MetadataRetrieve#get$entity.name()($entity.indicesList(true, false)) */ 
    112   public Object get$entity.name()($entity.indicesList(true, true)) { 
    113 #if ($last == "-") 
    114     // NB: $entity.name() unsupported for schema version $version 
    115     return null; 
    116 #else 
    117     return get${last}Node($entity.indicesList(false, true), false); 
    118 #end##if "-" 
    119   } 
    120 #end##foreach $entity 
    121 #foreach ($entity in $entities) 
    122 #set ($last = $entity.last($versionKey)) 
    123 #set ($lastVar = $entity.lastVar($versionKey)) 
    124  
    125   // - $entity.name() property retrieval - 
     110#foreach ($entity in $q.entities()) 
     111#set ($dummy = $q.setEntity($entity)) 
     112#set ($last = $q.last()) 
     113#set ($lastVar = $q.var($last)) 
     114 
     115  // - $entity property retrieval - 
    126116#foreach ($prop in $entity.props()) 
    127 #set ($mappedName = $prop.mappedName($versionKey)) 
     117#set ($dummy = $q.setProperty($prop)) 
     118  CTR START HERE 
     119#set ($mappedName = $q.Name($versionKey)) 
    128120#set ($convert = $mappedName.endsWith("%")) 
    129121#set ($mappedName = $mappedName.replaceAll("%", "")) 
Note: See TracChangeset for help on using the changeset viewer.