Commits

Anonymous committed 402ed0d

added getTags to ScriptApplicator; version to 1.5.0

Comments (0)

Files changed (2)

   <groupId>org.nrg</groupId>
   <artifactId>DicomEdit</artifactId>
   <packaging>jar</packaging>
-  <version>1.4.0</version>
+  <version>1.5.0</version>
   <name>DicomEdit</name>
   <description>Implementation of a language for modifying DICOM metadata</description>
   <url>http://nrg.wustl.edu</url>

src/main/java/org/nrg/dcm/edit/ScriptApplicator.java

 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.SortedSet;
+import java.util.TreeSet;
 
 import org.antlr.runtime.ANTLRInputStream;
 import org.antlr.runtime.CommonTokenStream;
         astParser = null;
     }
 
-
+    public SortedSet getTags() {
+        final SortedSet tags = new TreeSet();
+        for (final Iterator vi = astParser.getVariables().values().iterator(); vi.hasNext(); ) {
+            final Variable v = (Variable)vi.next();
+            final Value iv = v.getInitialValue();
+            if (null != iv) {
+                tags.addAll(v.getInitialValue().getTags());
+            }
+        }
+        for (final Iterator si = statements.getStatements().iterator(); si.hasNext(); ) {
+            final Statement s = (Statement)si.next();
+            tags.add(Integer.valueOf(s.getOperation().getTag()));
+        }
+        return tags;
+    }
+    
     public Variable getVariable(final String label) {
         return astParser.getVariable(label);
     }