All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.dakusui.lisj.func.io.Print Maven / Gradle / Ivy

There is a newer version: 0.8.17
Show newest version
package com.github.dakusui.lisj.func.io;

import java.io.PrintStream;

import com.github.dakusui.jcunit.core.Utils;
import com.github.dakusui.lisj.Context;
import com.github.dakusui.lisj.FormResult;
import com.github.dakusui.lisj.func.BaseFunc;

import static com.github.dakusui.lisj.Basic.*;

public class Print extends BaseFunc {

	/**
	 * Serial version UID.
	 */
	private static final long serialVersionUID = -2851340410686011195L;

	@Override
	protected FormResult evaluateLast(Context context, Object[] evaluatedParams, FormResult lastResult) {
		FormResult ret = lastResult;
		PrintStream pw = Utils.cast(PrintStream.class, Utils.checknull(evaluatedParams[0]));
		String s = Utils.checknull(evaluatedParams[1]).toString();
		pw.print(s);
		return ret;
	}

	@Override
	protected Object checkParams(Object params) {
		if (length(super.checkParams(params)) != 2) throw new IllegalArgumentException();
		Utils.checknull(get(params, 0));
		return params;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy