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

com.github.siwenyan.si.CustomExecutorPromptAnswer Maven / Gradle / Ivy

There is a newer version: 1.25.1.0
Show newest version
package com.github.siwenyan.si;

import java.util.HashMap;
import java.util.Map;

public class CustomExecutorPromptAnswer extends SiCommandExecutor {

    private final static String PROMPT_ID = "cus_prompt";
    private final static String ANSWER_ID = "cus_answer";

    protected String prompt;

    private Map customCalculators = new HashMap();

    public void putCalculator(String s, ICustomCalculator ICustomCalculator) {
        this.customCalculators.put(s, ICustomCalculator);
    }

    @Override
    public void execute(SiCommand command, SiContext siContext) throws SiVerifyException {

        String prompt = siContext.getVarValue(PROMPT_ID);
        String answer = this.customCalculators.get(this.prompt).calculate(prompt, command, siContext);
        siContext.addVar(ANSWER_ID, answer);

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy