[Swift-commit] r7875 - trunk/src/org/griphyn/vdl/mapping/file

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Sat May 17 21:29:15 CDT 2014


Author: hategan
Date: 2014-05-17 21:29:15 -0500 (Sat, 17 May 2014)
New Revision: 7875

Modified:
   trunk/src/org/griphyn/vdl/mapping/file/StructuredRegularExpressionMapper.java
Log:
somehow new lines were in windows style

Modified: trunk/src/org/griphyn/vdl/mapping/file/StructuredRegularExpressionMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/StructuredRegularExpressionMapper.java	2014-05-18 02:25:11 UTC (rev 7874)
+++ trunk/src/org/griphyn/vdl/mapping/file/StructuredRegularExpressionMapper.java	2014-05-18 02:29:15 UTC (rev 7875)
@@ -15,8 +15,8 @@
  */
 
 
-package org.griphyn.vdl.mapping.file;
-
+package org.griphyn.vdl.mapping.file;
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -37,21 +37,21 @@
 import org.griphyn.vdl.mapping.PhysicalFormat;
 import org.griphyn.vdl.type.Type;
 import org.griphyn.vdl.type.Types;
-
-public class StructuredRegularExpressionMapper extends AbstractMapper {
-
-        public static final Logger logger =
-            Logger.getLogger(StructuredRegularExpressionMapper.class);
+
+public class StructuredRegularExpressionMapper extends AbstractMapper {
+
+        public static final Logger logger =
+            Logger.getLogger(StructuredRegularExpressionMapper.class);
 		
 	@Override
     protected void getValidMappingParams(Set<String> s) {
 	    s.addAll(StructuredRegularExpressionMapperParams.NAMES);
         super.getValidMappingParams(s);
     }
-
-	public StructuredRegularExpressionMapper() {
-	}
 
+	public StructuredRegularExpressionMapper() {
+	}
+
 	@Override
     public String getName() {
         return "StructuredRegexpMapper";
@@ -62,55 +62,55 @@
         return new StructuredRegularExpressionMapperParams();
     }
 
-    @Override
+    @Override
 	public Collection<Path> existing() {
-	    StructuredRegularExpressionMapperParams cp = getParams();
-
-		DSHandle sourceHandle = cp.getSource();
-
-		Collection<Path> output = new ArrayList<Path>();
-		Collection<DSHandle> sourceFields;
-		try {
-			sourceFields = sourceHandle.getAllFields();
-		}
-		catch (InvalidPathException ipe) {
-			return Collections.emptyList();
-		}
+	    StructuredRegularExpressionMapperParams cp = getParams();
+
+		DSHandle sourceHandle = cp.getSource();
+
+		Collection<Path> output = new ArrayList<Path>();
+		Collection<DSHandle> sourceFields;
+		try {
+			sourceFields = sourceHandle.getAllFields();
+		}
+		catch (InvalidPathException ipe) {
+			return Collections.emptyList();
+		}
 		catch (HandleOpenException hoe) {
 		    // should not be happening since the mapper is only initialized after
-		    // all parameters have been closed
-			throw new RuntimeException("Handle open in mapper: " + sourceHandle);
-		}
-		Iterator<DSHandle> i = sourceFields.iterator();
-		while (i.hasNext()) {
-			DSHandle f = i.next();
-			output.add(f.getPathFromRoot());
-		}
-
-		return output;
+		    // all parameters have been closed
+			throw new RuntimeException("Handle open in mapper: " + sourceHandle);
+		}
+		Iterator<DSHandle> i = sourceFields.iterator();
+		while (i.hasNext()) {
+			DSHandle f = i.next();
+			output.add(f.getPathFromRoot());
+		}
+
+		return output;
 	}
     
     @Override
     public Collection<Path> existing(FileSystemLister l) {
         throw new UnsupportedOperationException();
-    }
+    }
 
-	@Override
+	@Override
 	public PhysicalFormat map(Path path) {
-	    if (logger.isDebugEnabled()) {
+	    if (logger.isDebugEnabled()) {
 	        logger.debug("map(): path: " + path);
 	    }
-        StructuredRegularExpressionMapperParams cp = getParams();
-
-		DSHandle sourceHandle = cp.getSource();
-		DSHandle hereHandle;
-		try {
-			hereHandle = sourceHandle.getField(path);
-		}
-		catch (InvalidPathException ipe) {
-			throw new RuntimeException("Cannot get requested path " + path
-					+ " from source data structure");
+        StructuredRegularExpressionMapperParams cp = getParams();
+
+		DSHandle sourceHandle = cp.getSource();
+		DSHandle hereHandle;
+		try {
+			hereHandle = sourceHandle.getField(path);
 		}
+		catch (InvalidPathException ipe) {
+			throw new RuntimeException("Cannot get requested path " + path
+					+ " from source data structure");
+		}
 		
 		String sourceStr;
 		Type sourceType = hereHandle.getType();
@@ -118,41 +118,41 @@
 		    sourceStr = (String) hereHandle.getValue();
 		}
 		else if (!sourceType.isComposite() && !sourceType.isPrimitive()) {
-    		PhysicalFormat source = hereHandle.getMapper().map(hereHandle.getPathFromRoot());
-    		if (!source.getType().equals("file")) {
-    			throw new RuntimeException(
-    					"Cannot use the regular expression mapper with a source that has a mapper that is not file-based");
+    		PhysicalFormat source = hereHandle.getMapper().map(hereHandle.getPathFromRoot());
+    		if (!source.getType().equals("file")) {
+    			throw new RuntimeException(
+    					"Cannot use the regular expression mapper with a source that has a mapper that is not file-based");
     		}
     		sourceStr = ((AbsFile) source).getPath();
 		}
 		else {
 		    throw new RuntimeException("Source must be an array of mapped objects or strings. Found " + sourceType);
-		}
-		Pattern p = Pattern.compile(cp.getMatch());
-		Matcher m = p.matcher(sourceStr);
-		if (!m.find()) {
-			throw new RuntimeException("No match found! source='" + sourceStr + "' match = '" + cp.getMatch()
-					+ "'");
-		}
-		// find group number to replace
-		Pattern p2 = Pattern.compile("(\\\\\\d)");
-		Matcher m2 = p2.matcher(cp.getTransform());
-		StringBuffer sb = new StringBuffer();
-		while (m2.find()) {
-			String group = m2.group(1);
-			int g = Integer.parseInt(group.substring(1));
-			m2.appendReplacement(sb, m.group(g));
-		}
-		m2.appendTail(sb);
-		return new AbsFile(sb.toString());
-	}
-
-	public Path rmap(String name) {
-		return Path.EMPTY_PATH;
-	}
-
-	public boolean isStatic() {
-		return true;
-	}
-
-}
+		}
+		Pattern p = Pattern.compile(cp.getMatch());
+		Matcher m = p.matcher(sourceStr);
+		if (!m.find()) {
+			throw new RuntimeException("No match found! source='" + sourceStr + "' match = '" + cp.getMatch()
+					+ "'");
+		}
+		// find group number to replace
+		Pattern p2 = Pattern.compile("(\\\\\\d)");
+		Matcher m2 = p2.matcher(cp.getTransform());
+		StringBuffer sb = new StringBuffer();
+		while (m2.find()) {
+			String group = m2.group(1);
+			int g = Integer.parseInt(group.substring(1));
+			m2.appendReplacement(sb, m.group(g));
+		}
+		m2.appendTail(sb);
+		return new AbsFile(sb.toString());
+	}
+
+	public Path rmap(String name) {
+		return Path.EMPTY_PATH;
+	}
+
+	public boolean isStatic() {
+		return true;
+	}
+
+}




More information about the Swift-commit mailing list