JAVA 设计模式 解释器模式

时间:2022-11-23 21:28:51

用途


解释器模式 (Interpreter)
定义一个语言,定义它的文法的一种表示。
并定义一个解释器,这个解释器使用该表示来解释语言中的句子。
解释器模式是一种行为型模式
结构

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjMAAAE4CAIAAAAhH+XLAAAgAElEQVR4nOzdZ0AURx8G8PUQAbsSA0ZFRCOISFAjGt/EGKNRAdEoCLbYE7tBsaDgUUSaFVuMRuyI2EXsCoINK+U4wIJSpAhSr+/uvB8G1uPocMAC/98nmJudHe52eW5nZ3cJBAAAALAJ0dAdAAAAAEqAZAIAAMAukEwAAADYBZIJAAAAu0AyAQAAYBdIJgAAAOwCyQQAAIBdIJkAAACwCyQTAAAAdoFkAgAAwC6QTAAAANgFkgkAAAC7QDIBAABgF0gmABonmkKUCCG6ofsBgPJBMgFWoklESxu6E+xWlEwANEGQTICVaBmihA3dCQBAw4BkAqyTm5ubDMohkUga+vMBoM5BMgHWcXR07ADK8ejRo4b+fACoc5BMgAVKjt3Z29tbWFg8fBj+MOzWw4cPHoKHDx8+fHj58uW2bduGh4c34AcFQP2AZAIsQFPy8x3s7e3nzZuHEI1oCcw9Y6Smpnbs2BGSCTQHkEyAdYqTCZQAyQSaD0gmwDr1l0w0iRBVHytSBkgm0HxAMgHWqX4y1SxdKEQKEFUPU92UE36QTKD5gGQCrFPNZKIRmY9oWTVXUrOlqo+WITJfKWfLIJlA8wHJBFin2sdMNFmTf/01W0qhBbKwskZoRMsQWYhoslbrgmQCzQkkE2CdWp5nEgqFq1evnidn2bJlOTk51W2noKDAzs5u3rx5t2/fLqcKXektlPh8/ry5c+fNmRkfH1fdDiiAZALNByQTYJ3aJFNqaqqbm1uHDh2srKzsizk5OeXl5VW4HIUoxRnqWVlZ2traBEH4+vrWrDMIobt37xIEQRBEaGhojRvBIJlA8wHJBFinNsn04MEDnAQ3btwo/WpsbGywnKxPGQhRSUlJwcFBwUFng4Ov4vKYmBgkl0yLFy8OD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BAMxCmQAAZqFMAACzUCYAgFkoEwDALJQJAGAWygQAMAtlAgCYhTIBAMxCmQAAZqFMAACzUCYAgFkoEwDALP8DDqvSqz1JJNAAAAAASUVORK5CYII=" alt="" />

图-解释器模式结构图

Context : 包含解释器之外的一些全局信息。
class Context {

    private String input;

    private String output;

    

    public void setInput(String input) {

        this.input = input;

    }

    

    public String getInput() {

        return this.input;

    }

    

    public void setOutput(String output) {

        this.output = output;

    }

    

    public String getOutput() {

        return this.output;

    }

}

AbstractExpression : 声明一个抽象的解释操作,这个接口为抽象语法树中所有的节点所共享。

abstract class AbstractExpression {

    public abstract void Interpret(Context context);

}

TerminalExpression : 实现与文法中的终结符相关联的解释操作。实现抽象表达式中所要求的接口,主要是一个 Interprete()方法。
文法中的每一个终结符都有一个具体终结表达式与之对应。

class TerminalExpression extends AbstractExpression {

    @Override

    public void Interpret(Context context) {

        context.setOutput("终端" + context.getInput());

        System.out.println(context.getInput() + "经过终端解释器解释为:" + context.getOutput());

    }

}

NonterminalExpression : 实现与文法中的非终结符相关联的解释操作。对文法中的每一条规则R1,R2......Rn都需要一个具体的非终结符表达式类。通过实现抽象表达式的 Interpret 方法实现解释操作。

class NonterminalExpression extends AbstractExpression {

    @Override

    public void Interpret(Context context) {

        context.setOutput("非终端" + context.getInput());

        System.out.println(context.getInput() + "经过非终端解释器解释为:" + context.getOutput());

    }

}

测试代码

JAVA 设计模式 解释器模式JAVA 设计模式 解释器模式
public class InterpreterPattern {
    public static void main(String[] args) {
        Context context = new Context();
        context.setInput("ABC");
        
        AbstractExpression expression1 = new TerminalExpression();
        expression1.Interpret(context);
        
        AbstractExpression expression2 = new NonterminalExpression();
        expression2.Interpret(context);
    }
}

运行结果

JAVA 设计模式 解释器模式JAVA 设计模式 解释器模式
ABC经过终端解释器解释为:终端ABC
ABC经过非终端解释器解释为:非终端ABC
推荐

本文属于 JAVA设计模式系列

参考资料

《大话设计模式》

《HeadFirst设计模式》