presto-main/src/main/java/io/prestosql/sql/planner/iterative/RuleIndex.java/Builder/register
class Builder:        public Builder register(Rule<?> rule)
        {
            Pattern<?> pattern = getFirstPattern(rule.getPattern());
            if (pattern instanceof TypeOfPattern) {
                rulesByRootType.put(((TypeOfPattern<?>) pattern).expectedClass(), rule);
            }
            else {
                throw new IllegalArgumentException("Unexpected Pattern: " + pattern);
            }
            return this;
        }