Package de.wwu.scdh.annotation.selection
Interface Rewriter<R extends Resource<?>,P1 extends Point,P2 extends Point>
- All Known Implementing Classes:
XPathNormalizer,XPathNormalizerWithXPath,XPathRefinedByRFC5147CharSchemeBackwardMapper,XPathRefinedByRFC5147CharSchemeForwardMapper,XPathRefinedByRFC5147CharSchemeToTextBackwardMapper,XPathRefinedByRFC5147CharSchemeToTextForwardMapper
A
Rewriter is a utility for rewriting a representation of a
Point in Resource to another representation. There
are different types of rewriters: normalizers, forward mappers, and
reverse mappers, which all do some kind of rewriting a
representation of a point. This common interface offers type-safe
rewriting of points in resources by type parameters.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumRewriting aPointinFORWARDdirection means to transform it in the same direction as using the same transformation for transforming a preimage to an image of a resource. -
Method Summary
-
Method Details
-
rewrite
Rewrite aPointin aResourceto the same point, but with a different (or potentially different) representation.A normalizer will typically return one recalculated point. A so-called forward mapper, which maps a point from a preimage resource to a derived resource, the image, may return zero, one or multiple points, depending on how many times a point in the preimage was mapped to the image. Thus, the return type is
ListofPoints.Note: It would be desirable, if we could declare a monadic return type with a type parameter,
M; and then use, e.g., the identity monad for normalizers, the list monad for forward mappers, the maybe monadOptionalfor reverse mappers. However, that cannot be expressed in the Java type system. Since the implied arities can easily be covered with an iterable, we use aList.- Parameters:
resource- theResourceto operate onposition- aPointin the resourceconfig- a record with configuration parameters- Returns:
- the same point like
position, but in a recalculated representation and wrapped into aList, which should represent the occurrences of the point in document order, if an order exists in the source. - Throws:
SelectorException- when the position cannot be found in the resource //
-