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

com.ql.util.express.instruction.ConstDataInstructionFactory Maven / Gradle / Ivy

Go to download

QLExpress is a powerful, lightweight, dynamic language for the Java platform aimed at improving developers’ productivity in different business scenes.

The newest version!
package com.ql.util.express.instruction;

import java.util.Stack;

import com.ql.util.express.ExpressRunner;
import com.ql.util.express.InstructionSet;
import com.ql.util.express.OperateData;
import com.ql.util.express.instruction.detail.InstructionConstData;
import com.ql.util.express.instruction.opdata.OperateClass;
import com.ql.util.express.parse.ExpressNode;

public class ConstDataInstructionFactory extends InstructionFactory {
    public OperateData genOperateData(ExpressNode node) {
        if (node.isTypeEqualsOrChild("CONST_CLASS")) {
            return new OperateClass(node.getValue(), (Class)node.getObjectValue());
        } else {
            return new OperateData(node.getObjectValue(), node.getObjectValue().getClass());
        }
    }

    @Override
    public boolean createInstruction(ExpressRunner expressRunner, InstructionSet result,
        Stack forStack, ExpressNode node, boolean isRoot) {
        result.addInstruction(new InstructionConstData(genOperateData(node)).setLine(node.getLine()));
        return false;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy