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

com.ql.util.express.instruction.InstructionFactory 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.HashMap;
import java.util.Map;
import java.util.Stack;

import com.ql.util.express.ExpressRunner;
import com.ql.util.express.InstructionSet;
import com.ql.util.express.parse.ExpressNode;

public abstract class InstructionFactory {
    private static final Map INSTRUCTION_FACTORY_MAP = new HashMap<>();

    public static InstructionFactory getInstructionFactory(String factory) {
        try {
            InstructionFactory result = INSTRUCTION_FACTORY_MAP.get(factory);
            if (result == null) {
                result = (InstructionFactory)Class.forName(factory).newInstance();
                INSTRUCTION_FACTORY_MAP.put(factory, result);
            }
            return result;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public abstract boolean createInstruction(ExpressRunner expressRunner, InstructionSet result,
        Stack forStack, ExpressNode node, boolean isRoot) throws Exception;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy