Mapped
Matcher implementation for the map
, flatMap
, and filter
operations.
- Type parameters:
- A
The type of the matched context.
- B
The transformed context type
- Value parameters:
- f
The transform operation
- inner
The transformed mapper
- op
The name of the operation, used by
toString
Value members
Concrete methods
Inherited methods
Create a new matcher by forming a chain with this matcher at the front, and the next
matcher at the back.
In other words, a matcher for a context within another context.
Create a new matcher by forming a chain with this matcher at the front, and the next
matcher at the back.
In other words, a matcher for a context within another context.
- Type parameters:
- A1
To satisfy covariance on A
- B
The
next
matcher's context type- R
The "reduced" content type, derived from the tuple type
(A, B)
based on thereduce
rule.
- Value parameters:
- next
A matcher which will be used to match the "inner" context
- reduce
The
TypeReduce
rule to help omitUnit
from the resulting context type
- Returns:
A matcher which delegates to
this
matcher first, then thenext
matcher for the remaining stack.- Inherited from:
- ContextMatcher
The main context match method.
The main context match method.
Inspects the elements in the XML "tag stack", which is essentially a List[StartElement]
, but for
performance reasons is represented as an array with an "offset" index and a number of available
elements from that offset. If the elements correspond to a context value of A
, the implementation
must then pass the remaining elements of the stack to the next
matcher, i.e. by calling
next(stack, offset + numConsumed, avail - numConsumed)
.
The difference between this method and applyChained
is the lack of the next
parameter; in this
method, the current matcher is assumed to be the end of the chain.
- Value parameters:
- avail
The number of elements available in the
stack
starting from theoffset
.- offset
The index of the first element to be considered by the matching logic. From this method's point of view, the "first" element in the stack is actually at
stack(offset)
- stack
A reference to the complete XML "tag stack". Note that the responsibility of this method is limited to a slice of this value, as defined by
offset
andavail
.
- Returns:
An option containing the successfully-matched context, or
None
.- Inherited from:
- ContextMatcher
Create a new ContextMatcher which will fall back to a second matcher in the event that this matcher fails to match a context.
Create a new ContextMatcher which will fall back to a second matcher in the event that this matcher fails to match a context.
- Type parameters:
- A2
The resulting context type (common supertype between this matcher and
that
)
- Value parameters:
- that
The matcher which will be used as the fallback
- Returns:
A matcher that falls back to another matcher in case of failure
- Inherited from:
- ContextMatcher