Class ElementFrequenciesVisitor

    • Constructor Detail

      • ElementFrequenciesVisitor

        public ElementFrequenciesVisitor(TreeNodeStream input)
    • Method Detail

      • getErrorManager

        public ErrorManager getErrorManager()
        During code gen, we can assume tree is in good shape
      • combineMax

        protected static FrequencySet<String> combineMax(FrequencySet<String> a,
                                                         FrequencySet<String> b)
        Generate a frequency set as the union of two input sets. If an element is contained in both sets, the value for the output will be the maximum of the two input values.
        Parameters:
        a - The first set.
        b - The second set.
        Returns:
        The union of the two sets, with the maximum value chosen whenever both sets contain the same key.
      • combineAndClip

        protected static FrequencySet<String> combineAndClip(FrequencySet<String> a,
                                                             FrequencySet<String> b,
                                                             int clip)
        Generate a frequency set as the union of two input sets, with the values clipped to a specified maximum value. If an element is contained in both sets, the value for the output, prior to clipping, will be the sum of the two input values.
        Parameters:
        a - The first set.
        b - The second set.
        clip - The maximum value to allow for any output.
        Returns:
        The sum of the two sets, with the individual elements clipped to the maximum value gived by clip.
      • enterAlternative

        protected void enterAlternative(AltAST tree)
      • exitAlternative

        protected void exitAlternative(AltAST tree)
      • enterElement

        protected void enterElement(GrammarAST tree)
      • exitElement

        protected void exitElement(GrammarAST tree)
      • exitSubrule

        protected void exitSubrule(GrammarAST tree)
      • enterLexerAlternative

        protected void enterLexerAlternative(GrammarAST tree)
      • exitLexerAlternative

        protected void exitLexerAlternative(GrammarAST tree)
      • enterLexerElement

        protected void enterLexerElement(GrammarAST tree)
      • exitLexerElement

        protected void exitLexerElement(GrammarAST tree)
      • exitLexerSubrule

        protected void exitLexerSubrule(GrammarAST tree)