Class LyreExpression

    • Method Detail

      • parse

        public static LyreExpression parse​(String pattern)
        Parse the given pattern into a LyreExpression.
        Parameters:
        pattern - the pattern
        Returns:
        the LyreExpression Expression
      • applyAsDouble

        public double applyAsDouble​(HString hString)
        Applies this expression to the given object converting it to a double
        Parameters:
        hString - the object to apply the expression on
        Returns:
        the double value
      • applyAsDouble

        public double applyAsDouble​(Object object)
        Applies this expression to the given object converting it to a double
        Parameters:
        object - the object to apply the expression on
        Returns:
        the double value
      • applyAsHString

        public HString applyAsHString​(HString string)
        Applies this expression to the given HString converting the result into an HString
        Parameters:
        string - the HString to apply the expression against
        Returns:
        the resulting HString
      • applyAsList

        public <T> List<T> applyAsList​(Object object,
                                       Class<T> elementType)
        Applies the given lambda against the given HString returning a list of of the given element type.
        Type Parameters:
        T - the list element parameter
        Parameters:
        object - the object to apply the lambda against
        elementType - the type information for the list elements
        Returns:
        the list of elements of the given type or null if the generated value is not convertible to a list of the given type
      • applyAsList

        public List<Object> applyAsList​(Object object)
        Applies the given lambda against the given HString returning a list
        Parameters:
        object - the object to apply the lambda against
        Returns:
        the list of objects or null if not convertible
      • applyAsObject

        public Object applyAsObject​(Object object)
        Applies this expression to given object.
        Parameters:
        object - the object to apply the expression on
        Returns:
        the result of the expression evaluation
      • applyAsString

        public String applyAsString​(Object object)
        Applies this expression to given object return a String value.
        Parameters:
        object - the object to apply the expression on
        Returns:
        the result of the expression evaluation as a String
      • count

        public Counter<String> count​(@NonNull
                                     @NonNull HString hString)
        Applies the expression returning a count over the string results.
        Parameters:
        hString - the HString to apply the expression against
        Returns:
        the counter
      • extract

        public Extraction extract​(@NonNull
                                  @NonNull HString hString)
        Description copied from interface: Extractor
        Generate an Extraction from the given HString.
        Specified by:
        extract in interface Extractor
        Parameters:
        hString - the source text from which we will generate an Extraction
        Returns:
        the Extraction
      • getPattern

        public String getPattern()
        Gets the Lyre Pattern that can generate this expression
        Returns:
        the Lyre pattern
      • testObject

        public boolean testObject​(Object object)
        Tests the given object against this LyreExpression
        Parameters:
        object - the object
        Returns:
        boolean based on expression evaluation