Class IPatternMap.PatternMap0

    • Constructor Detail

      • PatternMap0

        public PatternMap0()
    • Method Detail

      • get

        public int get​(IExpr patternOrSymbol)
        Description copied from interface: IPatternMap
        Get the int value mapped to the given pattern or symbol.
        Specified by:
        get in interface IPatternMap
        Parameters:
        patternOrSymbol - the given pattern or symbol
        Returns:
        -1 if the symbol isn't available in this map.
      • getValue

        public IExpr getValue​(int index)
        Description copied from interface: IPatternMap
        Return the matched value for the given index if possisble.
        Specified by:
        getValue in interface IPatternMap
        Returns:
        null if no matched expression exists
      • getValue

        public IExpr getValue​(IPatternObject pattern)
        Description copied from interface: IPatternMap
        Return the matched value for the given pattern object
        Specified by:
        getValue in interface IPatternMap
        Parameters:
        pattern - the pattern object
        Returns:
        null if no matched expression exists
      • initPattern

        public void initPattern()
        Description copied from interface: IPatternMap
        Set all pattern values to null;
        Specified by:
        initPattern in interface IPatternMap
      • isAllPatternsAssigned

        public boolean isAllPatternsAssigned()
        Description copied from interface: IPatternMap
        Check if all symbols in the symbols array have corresponding values assigned.
        Specified by:
        isAllPatternsAssigned in interface IPatternMap
        Returns:
      • isValueAssigned

        public boolean isValueAssigned()
        Description copied from interface: IPatternMap
        Returns true if the pattern matcher contains at least one value assigned.
        Specified by:
        isValueAssigned in interface IPatternMap
        Returns:
      • isFreeOfPatternSymbols

        public boolean isFreeOfPatternSymbols​(IExpr substitutedExpr)
        Description copied from interface: IPatternMap
        Check if the substituted expression still contains a symbol of a pattern expression.
        Specified by:
        isFreeOfPatternSymbols in interface IPatternMap
        Returns:
      • isRuleWithoutPatterns

        public boolean isRuleWithoutPatterns()
        Description copied from interface: IPatternMap
        Returns true if the pattern matcher contains no patterns
        Specified by:
        isRuleWithoutPatterns in interface IPatternMap
        Returns:
      • setValue

        public boolean setValue​(IPatternObject pattern,
                                IExpr expr)
        Description copied from interface: IPatternMap
        Assign the value to the pattern.
        Specified by:
        setValue in interface IPatternMap
        Parameters:
        pattern - the pattern expression
        Returns:
        true if assignment was successful, false otherwise.
      • setValue

        public boolean setValue​(IPatternSequence pattern,
                                IAST sequence)
        Description copied from interface: IPatternMap
        Assign the sequence to the pattern sequence.
        Specified by:
        setValue in interface IPatternMap
        Parameters:
        pattern - the pattern sequence expression
        Returns:
        true if assignment was successful, false otherwise.
      • size

        public int size()
        Description copied from interface: IPatternMap
        Gives the number of symbols used in this map.
        Specified by:
        size in interface IPatternMap
        Returns:
        the number of symbols used in this map.
      • substitutePatternOrSymbols

        public IExpr substitutePatternOrSymbols​(IExpr lhsPatternExpr,
                                                boolean onlyNamedPatterns)
        Description copied from interface: IPatternMap
        Substitute all patterns and symbols in the given expression with the current value of the corresponding internal pattern values arrays
        Specified by:
        substitutePatternOrSymbols in interface IPatternMap
        Parameters:
        lhsPatternExpr - left-hand-side expression which may contain pattern objects
        onlyNamedPatterns - TODO
        Returns:
        F.NIL if substitutions isn't possible
      • substituteSymbols

        public IExpr substituteSymbols​(IExpr rhsExpr,
                                       IExpr nilOrEmptySequence)
        Description copied from interface: IPatternMap
        Substitute all symbols in the given expression with the current value of the corresponding internal pattern values arrays and substitute all OptionValue(...) expressions with the corresponding option value from the current pattern-matching process.
        Specified by:
        substituteSymbols in interface IPatternMap
        Parameters:
        rhsExpr - right-hand-side expression, substitute all symbols from the pattern-matching values
        nilOrEmptySequence - default value F.NIL or F.Sequence()
        Returns: