com.scudata.expression.operator.ConjAssign 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.operator;
import com.scudata.common.MessageManager;
import com.scudata.common.RQException;
import com.scudata.dm.Context;
import com.scudata.dm.Sequence;
import com.scudata.expression.Operator;
import com.scudata.resources.EngineMessage;
/**
* ???????|=
* ???????ֵ
* @author RunQian
*
*/
public class ConjAssign extends Operator {
public ConjAssign() {
priority = PRI_MUL;
}
/**
* ??????ʽ????Ч?ԣ???Ч???׳??쳣
*/
public void checkValidity() {
if (left == null) {
MessageManager mm = EngineMessage.get();
throw new RQException("\"|=\"" + mm.getMessage("operator.missingLeftOperation"));
} else if (right == null) {
MessageManager mm = EngineMessage.get();
throw new RQException("\"|=\"" + mm.getMessage("operator.missingRightOperation"));
}
left.checkValidity();
right.checkValidity();
}
public Object calculate(Context ctx) {
Object o1 = left.calculate(ctx);
Object o2 = right.calculate(ctx);
Sequence s1, s2;
if (o1 instanceof Sequence) {
s1 = (Sequence)o1;
} else if (o1 == null) {
s1 = new Sequence(0);
} else {
s1 = new Sequence(1);
s1.add(o1);
}
if (o2 instanceof Sequence) {
s2 = (Sequence)o2;
} else if (o2 == null) {
s2 = new Sequence(0);
} else {
s2 = new Sequence(1);
s2.add(o2);
}
Sequence result = s1.conj(s2, false);
return left.assign(result, ctx);
}
/**
* ?ж??Ƿ???Լ???ȫ????ֵ???и?ֵ????ʱֻ??һ???м???
* @return
*/
public boolean canCalculateAll() {
return false;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy