com.scudata.expression.mfn.sequence.PSeg Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of esproc Show documentation
Show all versions of esproc Show documentation
SPL(Structured Process Language) A programming language specially for structured data computing.
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.expression.IParam;
import com.scudata.expression.SequenceFunction;
import com.scudata.resources.EngineMessage;
// A.pseg(x,y)
/**
* ȡָ??Ԫ?????????????е???һ??
* A.pseg(x) A.pseg(x,y)
* @author RunQian
*
*/
public class PSeg extends SequenceFunction {
/**
* ??????ʽ????Ч?ԣ???Ч???׳??쳣
*/
public void checkValidity() {
if (param == null) {
MessageManager mm = EngineMessage.get();
throw new RQException("pseg" + mm.getMessage("function.missingParam"));
}
}
public Object calculate(Context ctx) {
if (param.isLeaf()) {
Object value = param.getLeafExpression().calculate(ctx);
return srcSequence.pseg(value, option);
} else if (param.getSubSize() == 2) {
IParam sub0 = param.getSub(0);
IParam sub1 = param.getSub(1);
if (sub0 == null || sub1 == null) {
MessageManager mm = EngineMessage.get();
throw new RQException("pseg" + mm.getMessage("function.invalidParam"));
}
Sequence seq = srcSequence.calc(sub0.getLeafExpression(), "o", ctx);
Object value = sub1.getLeafExpression().calculate(ctx);
return seq.pseg(value, option);
} else {
MessageManager mm = EngineMessage.get();
throw new RQException("pseg" + mm.getMessage("function.invalidParam"));
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy