Class PlaceholderExpression

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.regex.Pattern PATTERN_PLACEHOLDER
      The regex used for pattern replacement
      private java.lang.String placeholder  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.lang.String determineArgument​(Selector matchingSelector, int index, java.lang.String type, Tagged p)
      Determines the index-th key/value/tag (depending on type) of the Selector.
      java.lang.Object evaluate​(Environment env)
      Evaluate this expression.
      static java.lang.String insertArguments​(Selector matchingSelector, java.lang.String s, Tagged p)
      Replaces occurrences of {i.key}, {i.value}, {i.tag} in s by the corresponding key/value/tag of the index-th Condition of matchingSelector.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • PATTERN_PLACEHOLDER

        public static final java.util.regex.Pattern PATTERN_PLACEHOLDER
        The regex used for pattern replacement
      • placeholder

        private final java.lang.String placeholder
    • Method Detail

      • evaluate

        public java.lang.Object evaluate​(Environment env)
        Description copied from interface: Expression
        Evaluate this expression.
        Specified by:
        evaluate in interface Expression
        Parameters:
        env - The environment
        Returns:
        the result of the evaluation, can be a List, String or any primitive type or wrapper classes of a primitive type.
      • insertArguments

        public static java.lang.String insertArguments​(Selector matchingSelector,
                                                       java.lang.String s,
                                                       Tagged p)
        Replaces occurrences of {i.key}, {i.value}, {i.tag} in s by the corresponding key/value/tag of the index-th Condition of matchingSelector.
        Parameters:
        matchingSelector - matching selector
        s - any string
        p - OSM primitive
        Returns:
        string with arguments inserted
      • determineArgument

        private static java.lang.String determineArgument​(Selector matchingSelector,
                                                          int index,
                                                          java.lang.String type,
                                                          Tagged p)
        Determines the index-th key/value/tag (depending on type) of the Selector.
        Parameters:
        matchingSelector - matching selector
        index - index
        type - selector type ("key", "value" or "tag")
        p - OSM primitive
        Returns:
        argument value, can be null
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object