package orc.orchard.values;

import java.util.LinkedList;

import orc.runtime.values.Visitor;

public class ValueMarshaller extends Visitor<Object> {
	public Object visit(orc.runtime.values.ListValue v) {
		java.util.List<Object> list = v.enlist();
		java.util.List<Object> mlist = new LinkedList<Object>();
		for (Object v2 : list) {
			mlist.add(visit(this, v2));
		}
		return new List(mlist.toArray(new Object[]{}));
	}

	public Object visit(orc.runtime.values.TupleValue v) {
		Object mvalues[] = new Object[v.size()];
		int i = 0;
		for (Object v2 : v) {
			mvalues[i++] = visit(this, v2);
		}
		return new Tuple(mvalues);
	}

	public Object visit(orc.runtime.values.Value v) {
		return new UnrepresentableValue(v.toString());
	}

	@Override
	public Object visit(Object value) {
		if (value instanceof String) {
		} else if (value instanceof Boolean) {
		} else if (value instanceof Number) {
		} else if (value instanceof Character) {
		} else if (value instanceof	java.util.Calendar) {
		} else if (value instanceof	java.util.Date) {
		} else if (value instanceof	javax.xml.namespace.QName) {
		} else if (value instanceof	java.net.URI) {
		} else if (value instanceof	javax.xml.datatype.Duration) {
		} else if (value instanceof	java.util.UUID) {
		} else {
			return new UnrepresentableValue(value.toString());
		}
		return value;
	}
}

@@ -781,32 +781,79 @@
 ) %7B%0A%09%09if (value 
+== null) %7B%0A%09%09%09return value;%0A%09%09%7D else if (value 
 instanceof Strin

Fix bug with null values published.