[Swift-commit] r4743 - trunk/src/org/griphyn/vdl/mapping/file
hategan at ci.uchicago.edu
hategan at ci.uchicago.edu
Sat Jul 2 23:12:38 CDT 2011
Author: hategan
Date: 2011-07-02 23:12:37 -0500 (Sat, 02 Jul 2011)
New Revision: 4743
Modified:
trunk/src/org/griphyn/vdl/mapping/file/SimpleFileMapper.java
Log:
reverted previous change to the simple_mapper; it broke the fmri test and didn't really conform to what the documentation was saying (i.e. it couldn't map arrays of strucs)'
Modified: trunk/src/org/griphyn/vdl/mapping/file/SimpleFileMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/SimpleFileMapper.java 2011-07-03 02:37:10 UTC (rev 4742)
+++ trunk/src/org/griphyn/vdl/mapping/file/SimpleFileMapper.java 2011-07-03 04:12:37 UTC (rev 4743)
@@ -4,72 +4,19 @@
package org.griphyn.vdl.mapping.file;
import java.util.Map;
-import java.util.HashMap;
-import org.griphyn.vdl.mapping.Path;
-import org.griphyn.vdl.mapping.PhysicalFormat;
-import org.griphyn.vdl.mapping.AbsFile;
import org.griphyn.vdl.mapping.MappingParam;
public class SimpleFileMapper extends AbstractFileMapper {
public static final MappingParam PARAM_PADDING = new MappingParam("padding", new Integer(4));
- private Map filenames = new HashMap();
- private int count = 0;
- private String isinput;
public SimpleFileMapper() {
super();
-
-
}
public void setParams(Map params) {
super.setParams(params);
int precision = PARAM_PADDING.getIntValue(this);
setElementMapper(new DefaultFileNameElementMapper(precision));
- this.isinput = (String)params.get("input");
}
-
- //all input filesnames will be parsed as strings and given numeric index
-
- public Path rmap(String name) {
- if(this.isinput == null){
- return super.rmap(name);
- }
- if (name == null || name.equals("")) {
- return null;
- }
- String index = String.valueOf(count);
- filenames.put(index, name);
- Path p = Path.EMPTY_PATH;
- p = p.addFirst(index, true);
- ++count;
- return p;
- }
-
- public PhysicalFormat map(Path path) {
- if(this.isinput == null){
- return super.map(path);
- }
- if (path.size()!=1) {
- return null;
- }
- if (!path.isArrayIndex(0)) {
- return null;
- }
- String location = PARAM_LOCATION.getStringValue(this);
- String index = path.getFirst();
- String filename = (String)filenames.get(index);
- if (filename == null) {
- return null;
- }
- if (location != null) {
- if (!location.endsWith("/")) {
- filename = location + '/' + filename;
- } else {
- filename = location + filename;
- }
- }
- return new AbsFile(filename);
- }
}
More information about the Swift-commit
mailing list