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

com.scudata.expression.mfn.sequence.Conjx 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.sequence;

import com.scudata.common.MessageManager;
import com.scudata.common.RQException;
import com.scudata.dm.Context;
import com.scudata.dm.Sequence;
import com.scudata.dm.cursor.ConjxCursor;
import com.scudata.dm.cursor.ICursor;
import com.scudata.expression.SequenceFunction;
import com.scudata.resources.EngineMessage;

/**
 * ????????α????з??س??α꣬?ṹ?Ե?һ??Ϊ׼
 * CS.conjx()
 * @author RunQian
 *
 */
public class Conjx extends SequenceFunction {
	public Object calculate(Context ctx) {
		int len = srcSequence.length();
		Sequence cursorSeq = new Sequence(len);
		
		for (int i = 1; i <= len; ++i) {
			Object obj = srcSequence.getMem(i);
			if (obj instanceof ICursor) {
				cursorSeq.add(obj);
			} else if (obj != null) {
				MessageManager mm = EngineMessage.get();
				throw new RQException("conjx" + mm.getMessage("function.paramTypeError"));
			}
		}
		
		len = cursorSeq.length();
		if (len > 0) {
			ICursor[] cursors = new ICursor[len];
			cursorSeq.toArray(cursors);
			return new ConjxCursor(cursors);
		} else {
			return null;
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy