// Path: big-data-java/src/easy/data/field/CompField.java
// public class CompField extends ADataField implements IDataField {
// 	private HashMap<String, IDataField> fieldMap;
// 
// 	public CompField() {
// 		this(null);
// 	}
// 
// 	public CompField(String basePath) {
// 		this(basePath, null);
// 	}
// 
// 	public CompField(String basePath, String description) {
// 		super(basePath, description);
// 		this.fieldMap = new HashMap<String, IDataField>();
// 	}
// 
// 	public IDataField addField(String name, IDataField fld) {
// 		return fieldMap.put(name, fld);
// 	}
// 	
// 	public String[] fieldNames() {
// 		return fieldMap.keySet().toArray(new String[] {});
// 	}
// 	
// 	public Collection<IDataField> fields() {
// 		return fieldMap.values();
// 	}
// 	
// 	public IDataField getField(String name) {
// 		return fieldMap.get(name);
// 	}
// 	
// 	public boolean hasField(String name) {
// 		return fieldMap.containsKey(name);
// 	}
// 
// 	public <T> T apply(IDFVisitor<T> fv) {
// 		return fv.visitCompField(this, this.basePath, this.description, this.fieldMap);
// 	}
// 
// 	public String toString() {
// 		String m = "{_<" + basePath + "> ";
// 		boolean firstDone = false;
// 		for (String k : fieldNames()) {
// 			if (firstDone) { m += ", "; } else { firstDone = true; }
// 			m += (k + ": " + fieldMap.get(k));
// 		}
// 		m += "}";
// 		return m;
// 	}
// 
// }
// 
// Path: big-data-java/src/easy/data/field/IDFVisitor.java
// public interface IDFVisitor<T> {
// 	public T defaultVisit(IDataField df);
// 	public T visitPrimField(PrimField f, String basePath, String description);
// 	public T visitCompField(CompField f, String basePath, String description, HashMap<String, IDataField> fieldMap);
// 	public T visitListField(ListField f, String basePath, String description, String elemPath, IDataField elemField);
// }
// 
// Path: big-data-java/src/easy/data/field/IDataField.java
// public interface IDataField {
// 	public String getDescription();
// 	public <T> T apply(IDFVisitor<T> fv);
// }
// 
// Path: big-data-java/src/easy/data/field/ListField.java
// public class ListField extends ADataField implements IDataField {
// 	private String elemPath;
// 	private IDataField elemField;
// 
// 	public ListField(String basepath, String elempath, IDataField basefld) {
// 		this(basepath, elempath, basefld, null);
// 	}
// 	
// 	public ListField(String basepath, String elemPath, IDataField elemField, String description) {
// 		super(basepath, description);
// 		this.elemPath = elemPath;
// 		this.elemField = elemField;
// 	}
// 	
// 	public String getElemPath() {
// 		return this.elemPath;
// 	}
// 	
// 	public IDataField getElemField() {
// 		return this.elemField;
// 	}
// 
// 	public <T> T apply(IDFVisitor<T> fv) {
// 		return fv.visitListField(this, this.basePath, this.description, this.elemPath, this.elemField);
// 	}
// 
// 	public String toString() {
// 		return "[_<" + basePath + "," + elemPath + "> " + elemField + "]";
// 	}
// 
// }
// 
// Path: big-data-java/src/easy/data/field/PrimField.java
// public class PrimField extends ADataField implements IDataField {
// 	public PrimField() {
// 		super(null, null);
// 	}
// 	
// 	public PrimField(String path) {
// 		super(path, null);
// 	}
// 	
// 	public PrimField(String path, String description) {
// 		super(path, description);
// 	}
// 	
// 	public <T> T apply(IDFVisitor<T> fv) {
// 		return fv.visitPrimField(this, this.basePath, this.description);
// 	}
// 
// 	public String toString() {
// 		return "<" + basePath + ">";
// 	}
// }


import java.util.HashMap;
import easy.data.field.CompField;
import easy.data.field.IDFVisitor;
import easy.data.field.IDataField;
import easy.data.field.ListField;
import easy.data.field.PrimField;
package easy.data.xml;



/**
 * When applied to a data field, it takes all subfields of that data field,
 * and adds them as a top-level field to the targetfield, with the given path.
 * If 'toplevel' is true, it skips primitive and list fields in the process.
 * If 'wraplist' is true, it wraps any fields as a list when adding them to 
 * targetfield.
 */
public class SubFieldCollector implements IDFVisitor<Void> {
	CompField targetField;
	String prefix;
	boolean topLevel;
	boolean wrapList;
	
	public SubFieldCollector(CompField targetField, String prefix) {
		this(targetField, prefix, true, false);
	}
	
// Path: big-data-java/src/easy/data/field/CompField.java
// public class CompField extends ADataField implements IDataField {
// 	private HashMap<String, IDataField> fieldMap;
// 
// 	public CompField() {
// 		this(null);
// 	}
// 
// 	public CompField(String basePath) {
// 		this(basePath, null);
// 	}
// 
// 	public CompField(String basePath, String description) {
// 		super(basePath, description);
// 		this.fieldMap = new HashMap<String, IDataField>();
// 	}
// 
// 	public IDataField addField(String name, IDataField fld) {
// 		return fieldMap.put(name, fld);
// 	}
// 	
// 	public String[] fieldNames() {
// 		return fieldMap.keySet().toArray(new String[] {});
// 	}
// 	
// 	public Collection<IDataField> fields() {
// 		return fieldMap.values();
// 	}
// 	
// 	public IDataField getField(String name) {
// 		return fieldMap.get(name);
// 	}
// 	
// 	public boolean hasField(String name) {
// 		return fieldMap.containsKey(name);
// 	}
// 
// 	public <T> T apply(IDFVisitor<T> fv) {
// 		return fv.visitCompField(this, this.basePath, this.description, this.fieldMap);
// 	}
// 
// 	public String toString() {
// 		String m = "{_<" + basePath + "> ";
// 		boolean firstDone = false;
// 		for (String k : fieldNames()) {
// 			if (firstDone) { m += ", "; } else { firstDone = true; }
// 			m += (k + ": " + fieldMap.get(k));
// 		}
// 		m += "}";
// 		return m;
// 	}
// 
// }
// 
// Path: big-data-java/src/easy/data/field/IDFVisitor.java
// public interface IDFVisitor<T> {
// 	public T defaultVisit(IDataField df);
// 	public T visitPrimField(PrimField f, String basePath, String description);
// 	public T visitCompField(CompField f, String basePath, String description, HashMap<String, IDataField> fieldMap);
// 	public T visitListField(ListField f, String basePath, String description, String elemPath, IDataField elemField);
// }
// 
// Path: big-data-java/src/easy/data/field/IDataField.java
// public interface IDataField {
// 	public String getDescription();
// 	public <T> T apply(IDFVisitor<T> fv);
// }
// 
// Path: big-data-java/src/easy/data/field/ListField.java
// public class ListField extends ADataField implements IDataField {
// 	private String elemPath;
// 	private IDataField elemField;
// 
// 	public ListField(String basepath, String elempath, IDataField basefld) {
// 		this(basepath, elempath, basefld, null);
// 	}
// 	
// 	public ListField(String basepath, String elemPath, IDataField elemField, String description) {
// 		super(basepath, description);
// 		this.elemPath = elemPath;
// 		this.elemField = elemField;
// 	}
// 	
// 	public String getElemPath() {
// 		return this.elemPath;
// 	}
// 	
// 	public IDataField getElemField() {
// 		return this.elemField;
// 	}
// 
// 	public <T> T apply(IDFVisitor<T> fv) {
// 		return fv.visitListField(this, this.basePath, this.description, this.elemPath, this.elemField);
// 	}
// 
// 	public String toString() {
// 		return "[_<" + basePath + "," + elemPath + "> " + elemField + "]";
// 	}
// 
// }
// 
// Path: big-data-java/src/easy/data/field/PrimField.java
// public class PrimField extends ADataField implements IDataField {
// 	public PrimField() {
// 		super(null, null);
// 	}
// 	
// 	public PrimField(String path) {
// 		super(path, null);
// 	}
// 	
// 	public PrimField(String path, String description) {
// 		super(path, description);
// 	}
// 	
// 	public <T> T apply(IDFVisitor<T> fv) {
// 		return fv.visitPrimField(this, this.basePath, this.description);
// 	}
// 
// 	public String toString() {
// 		return "<" + basePath + ">";
// 	}
// }


// Path: big-data-java/src/easy/data/xml/SubFieldCollector.java
import java.util.HashMap;
import easy.data.field.CompField;
import easy.data.field.IDFVisitor;
import easy.data.field.IDataField;
import easy.data.field.ListField;
import easy.data.field.PrimField;

package easy.data.xml;



/**
 * When applied to a data field, it takes all subfields of that data field,
 * and adds them as a top-level field to the targetfield, with the given path.
 * If 'toplevel' is true, it skips primitive and list fields in the process.
 * If 'wraplist' is true, it wraps any fields as a list when adding them to 
 * targetfield.
 */
public class SubFieldCollector implements IDFVisitor<Void> {
	CompField targetField;
	String prefix;
	boolean topLevel;
	boolean wrapList;
	
	public SubFieldCollector(CompField targetField, String prefix) {
		this(targetField, prefix, true, false);
	}
	
	public SubFieldCollector(CompField targetField, String prefix,