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

com.scudata.expression.mfn.op.AttachPush Maven / Gradle / Ivy

Go to download

SPL(Structured Process Language) A programming language specially for structured data computing.

There is a newer version: 20240823
Show newest version
package com.scudata.expression.mfn.op;

import com.scudata.common.MessageManager;
import com.scudata.common.RQException;
import com.scudata.dm.Context;
import com.scudata.dm.op.Channel;
import com.scudata.dm.op.Push;
import com.scudata.expression.IParam;
import com.scudata.expression.OperableFunction;
import com.scudata.resources.EngineMessage;

/**
 * ???α??ܵ????????????ݵ??ܵ???????
 * op.push(chi??) op???α??ܵ?
 * @author RunQian
 *
 */
public class AttachPush extends OperableFunction {
	public Object calculate(Context ctx) {
		if (param == null) {
			MessageManager mm = EngineMessage.get();
			throw new RQException("push" + mm.getMessage("function.missingParam"));
		} else if (param.isLeaf()) {
			Object obj = param.getLeafExpression().calculate(ctx);
			if (!(obj instanceof Channel)) {
				MessageManager mm = EngineMessage.get();
				throw new RQException("push" + mm.getMessage("function.paramTypeError"));
			}
			
			Push push = new Push(this, (Channel)obj);
			if (cs != null) {
				push.setCurrentCell(cs.getCurrent());
			}
			
			return operable.addOperation(push, ctx);
		} else {
			for (int i = 0, size = param.getSubSize(); i < size; ++i) {
				IParam sub = param.getSub(i);
				if (sub == null) {
					MessageManager mm = EngineMessage.get();
					throw new RQException("push" + mm.getMessage("function.invalidParam"));
				}
				
				Object obj = sub.getLeafExpression().calculate(ctx);
				if (!(obj instanceof Channel)) {
					MessageManager mm = EngineMessage.get();
					throw new RQException("push" + mm.getMessage("function.paramTypeError"));
				}
				
				Push push = new Push(this, (Channel)obj);
				if (cs != null) {
					push.setCurrentCell(cs.getCurrent());
				}
				
				operable.addOperation(push, ctx);
			}
			
			return operable;
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy