Class BasicSequenceMatchResult<T>

    • Constructor Detail

      • BasicSequenceMatchResult

        public BasicSequenceMatchResult()
    • Method Detail

      • elements

        public List<? extends T> elements()
        Description copied from interface: SequenceMatchResult
        Returns the original sequence the match was performed on.
        Specified by:
        elements in interface SequenceMatchResult<T>
        Returns:
        The list that the match was performed on
      • setOrder

        public void setOrder​(int order)
      • start

        public int start​(int group)
        Specified by:
        start in interface MatchResult
      • start

        public int start​(String var)
        Description copied from interface: SequenceMatchResult
        Returns the start index of the subsequence captured by the given group during this match.
        Specified by:
        start in interface SequenceMatchResult<T>
        Parameters:
        var - The name of the capturing group in this matcher's pattern
        Returns:
        the index of the first element captured by the group, or -1 if the match was successful but the group itself did not match anything or if there is no capturing group in the pattern with the given name
      • end

        public int end​(int group)
        Specified by:
        end in interface MatchResult
      • end

        public int end​(String var)
        Description copied from interface: SequenceMatchResult
        Returns the index of the next element after the subsequence captured by the given group during this match.
        Specified by:
        end in interface SequenceMatchResult<T>
        Parameters:
        var - The name of the capturing group in this matcher's pattern
        Returns:
        the index of the next element after the subsequence captured by the group, or -1 if the match was successful but the group itself did not match anything or if there is no capturing group in the pattern with the given name
      • group

        public String group​(String var)
        Description copied from interface: SequenceMatchResult
        Returns the String representing the matched group.
        Specified by:
        group in interface SequenceMatchResult<T>
        Parameters:
        var - The name of the capturing group in this matcher's pattern
        Returns:
        the matched group as a String or null if there is no capturing group in the pattern with the given name
      • groupNodes

        public List<T> groupNodes​(int group)
        Description copied from interface: SequenceMatchResult
        Returns the matched group as a list.
        Specified by:
        groupNodes in interface SequenceMatchResult<T>
        Parameters:
        group - The index of a capturing group in this matcher's pattern
        Returns:
        the matched group as a list
      • groupNodes

        public List<? extends T> groupNodes​(String var)
        Description copied from interface: SequenceMatchResult
        Returns the matched group as a list.
        Specified by:
        groupNodes in interface SequenceMatchResult<T>
        Parameters:
        var - The name of the capturing group in this matcher's pattern
        Returns:
        the matched group as a list or null if there is no capturing group in the pattern with the given name
      • groupValue

        public Object groupValue()
        Description copied from interface: SequenceMatchResult
        Returns the value (some Object) associated with the entire matched sequence.
        Specified by:
        groupValue in interface SequenceMatchResult<T>
        Returns:
        value associated with the matched sequence.
      • groupValue

        public Object groupValue​(int group)
        Description copied from interface: SequenceMatchResult
        Returns the value (some Object) associated with the captured group.
        Specified by:
        groupValue in interface SequenceMatchResult<T>
        Parameters:
        group - The index of a capturing group in this matcher's pattern
        Returns:
        value associated with the captured group.
      • groupValue

        public Object groupValue​(String var)
        Description copied from interface: SequenceMatchResult
        Returns the value (some Object) associated with the captured group.
        Specified by:
        groupValue in interface SequenceMatchResult<T>
        Parameters:
        var - The name of the capturing group in this matcher's pattern
        Returns:
        value associated with the captured group.
      • groupMatchResults

        public List<Object> groupMatchResults()
        Description copied from interface: SequenceMatchResult
        Returns a list of Objects representing the match results for the entire sequence.
        Specified by:
        groupMatchResults in interface SequenceMatchResult<T>
        Returns:
        the list of match results associated with the entire sequence
      • groupMatchResults

        public List<Object> groupMatchResults​(int group)
        Description copied from interface: SequenceMatchResult
        Returns a list of Objects representing the match results for the nodes in the group.
        Specified by:
        groupMatchResults in interface SequenceMatchResult<T>
        Parameters:
        group - The index of a capturing group in this matcher's pattern
        Returns:
        the list of match results associated with the nodes for the captured group.
      • groupMatchResults

        public List<Object> groupMatchResults​(String var)
        Description copied from interface: SequenceMatchResult
        Returns a list of Objects representing the match results for the nodes in the group.
        Specified by:
        groupMatchResults in interface SequenceMatchResult<T>
        Parameters:
        var - The name of the capturing group in this matcher's pattern
        Returns:
        the list of match results associated with the nodes for the captured group.
      • nodeMatchResult

        public Object nodeMatchResult​(int index)
        Description copied from interface: SequenceMatchResult
        Returns an Object representing the result for the match for a particular node. (actual Object returned depends on the type T of the nodes). For instance, for a CoreMap, the match result is returned as a Map<Class, Object>, while for String, the match result is typically a MatchResult.
        Specified by:
        nodeMatchResult in interface SequenceMatchResult<T>
        Parameters:
        index - The index of the element in the original sequence.
        Returns:
        The match result associated with the node at the given index.
      • groupMatchResult

        public Object groupMatchResult​(int group,
                                       int index)
        Description copied from interface: SequenceMatchResult
        Returns an Object representing the result for the match for a particular node in a group. (actual Object returned depends on the type T of the nodes. For instance, for a CoreMap, the match result is returned as a Map<Class, Object>, while for String, the match result is typically a MatchResult.
        Specified by:
        groupMatchResult in interface SequenceMatchResult<T>
        Parameters:
        group - The index of a capturing group in this matcher's pattern
        index - The index of the element in the captured subsequence.
        Returns:
        the match result associated with the node at the given index for the captured group.
      • groupMatchResult

        public Object groupMatchResult​(String var,
                                       int index)
        Description copied from interface: SequenceMatchResult
        Returns an Object representing the result for the match for a particular node in a group. (actual Object returned depends on the type T of the nodes. For instance, for a CoreMap, the match result is returned as a Map<Class, Object>, while for String, the match result is typically a MatchResult.
        Specified by:
        groupMatchResult in interface SequenceMatchResult<T>
        Parameters:
        var - The name of the capturing group in this matcher's pattern
        index - The index of the element in the captured subsequence.
        Returns:
        the match result associated with the node at the given index for the captured group.