2021SC@SDUSC
目录
RULE
public abstract class Rule {
protected String name = null;
protected OperatorPlan pattern;
transient protected OperatorPlan currentPlan;
private transient Set<Operator> matchedNodes =
new HashSet<Operator>();
private boolean mandatory;
private boolean skipListener = false;
Rule已经把 match(OperatorPlan plan)方法的逻辑实现好了。
子类
子类需要实现的是buildPattern()方法,来制定各自的”模式”,即pattern变量,此外,子类还需要实现getNewTransformer()方法来实例化一个transformer,transformer的check()和transform()方法会进一步处理rule匹配的operators。
Rulematch()的用途是确保plan的所有子plan都满足该rule的pattern。