R
- the result of scanning the two AnnotatedTypeMirror
spublic abstract class DoubleAnnotatedTypeScanner<R> extends AnnotatedTypeScanner<R,AnnotatedTypeMirror>
AnnotatedTypeScanner
that scans two AnnotatedTypeMirror
s simultaneously and
performs defaultAction(AnnotatedTypeMirror, AnnotatedTypeMirror)
on the pair. Both
AnnotatedTypeMirrors must have the same structure, or a subclass must arrange not to continue
recursing past the point at which their structure diverges.
If the default action does not return a result, then R
should be Void
and
DoubleAnnotatedTypeScanner()
should be used to construct the scanner. If the default
action returns a result, then specify a AnnotatedTypeScanner.reduce(R, R)
function and use DoubleAnnotatedTypeScanner(Reduce, Object)
.
AnnotatedTypeScanner
AnnotatedTypeScanner.Reduce<R>
defaultResult, reduceFunction, visitedNodes
Modifier | Constructor and Description |
---|---|
protected |
DoubleAnnotatedTypeScanner()
Constructs an AnnotatedTypeScanner where the reduce function returns the first result if it is
nonnull; otherwise the second result is returned.
|
protected |
DoubleAnnotatedTypeScanner(AnnotatedTypeScanner.Reduce<R> reduce,
R defaultResult)
Creates a scanner with the given
reduce function and defaultResult . |
reduce, reset, scan, scanAndReduce, visit, visit, visitNoType, visitNull, visitPrimitive
protected DoubleAnnotatedTypeScanner()
null
.protected DoubleAnnotatedTypeScanner(AnnotatedTypeScanner.Reduce<R> reduce, R defaultResult)
reduce
function and defaultResult
.reduce
- function used to combine the results of scandefaultResult
- result to use by defaultprotected abstract R defaultAction(AnnotatedTypeMirror type, AnnotatedTypeMirror p)
type
- the type to visitp
- a visitor-specified parameterprotected R scan(Iterable<? extends AnnotatedTypeMirror> types1, Iterable<? extends AnnotatedTypeMirror> types2)
types1
- typestypes2
- typestypes1
and types2
or AnnotatedTypeScanner.defaultResult
if they are emptyprotected R scanAndReduce(Iterable<? extends AnnotatedTypeMirror> types, Iterable<? extends AnnotatedTypeMirror> p, R r)
scan(java.lang.Iterable<? extends org.checkerframework.framework.type.AnnotatedTypeMirror>, java.lang.Iterable<? extends org.checkerframework.framework.type.AnnotatedTypeMirror>)
on types and p, then run AnnotatedTypeScanner.reduce(R, R)
on the result (plus r) to return a
single element.protected final R scanAndReduce(Iterable<? extends AnnotatedTypeMirror> types, AnnotatedTypeMirror p, R r)
scanAndReduce
in class AnnotatedTypeScanner<R,AnnotatedTypeMirror>
protected R scan(AnnotatedTypeMirror type, AnnotatedTypeMirror p)
AnnotatedTypeScanner
type
by calling type.accept(this, p)
; this method may be overridden by
subclasses.scan
in class AnnotatedTypeScanner<R,AnnotatedTypeMirror>
type
- type to scanp
- the parameter to usetype
public final R visitDeclared(AnnotatedTypeMirror.AnnotatedDeclaredType type, AnnotatedTypeMirror p)
AnnotatedTypeVisitor
visitDeclared
in interface AnnotatedTypeVisitor<R,AnnotatedTypeMirror>
visitDeclared
in class AnnotatedTypeScanner<R,AnnotatedTypeMirror>
type
- the type to visitp
- a visitor-specified parameterpublic final R visitArray(AnnotatedTypeMirror.AnnotatedArrayType type, AnnotatedTypeMirror p)
AnnotatedTypeVisitor
visitArray
in interface AnnotatedTypeVisitor<R,AnnotatedTypeMirror>
visitArray
in class AnnotatedTypeScanner<R,AnnotatedTypeMirror>
type
- the type to visitp
- a visitor-specified parameterpublic final R visitExecutable(AnnotatedTypeMirror.AnnotatedExecutableType type, AnnotatedTypeMirror p)
AnnotatedTypeVisitor
visitExecutable
in interface AnnotatedTypeVisitor<R,AnnotatedTypeMirror>
visitExecutable
in class AnnotatedTypeScanner<R,AnnotatedTypeMirror>
type
- the type to visitp
- a visitor-specified parameterpublic R visitTypeVariable(AnnotatedTypeMirror.AnnotatedTypeVariable type, AnnotatedTypeMirror p)
AnnotatedTypeVisitor
visitTypeVariable
in interface AnnotatedTypeVisitor<R,AnnotatedTypeMirror>
visitTypeVariable
in class AnnotatedTypeScanner<R,AnnotatedTypeMirror>
type
- the type to visitp
- a visitor-specified parameterpublic R visitWildcard(AnnotatedTypeMirror.AnnotatedWildcardType type, AnnotatedTypeMirror p)
AnnotatedTypeVisitor
visitWildcard
in interface AnnotatedTypeVisitor<R,AnnotatedTypeMirror>
visitWildcard
in class AnnotatedTypeScanner<R,AnnotatedTypeMirror>
type
- the type to visitp
- a visitor-specified parameterpublic R visitIntersection(AnnotatedTypeMirror.AnnotatedIntersectionType type, AnnotatedTypeMirror p)
AnnotatedTypeVisitor
visitIntersection
in interface AnnotatedTypeVisitor<R,AnnotatedTypeMirror>
visitIntersection
in class AnnotatedTypeScanner<R,AnnotatedTypeMirror>
type
- the type to visitp
- a visitor-specified parameterpublic R visitUnion(AnnotatedTypeMirror.AnnotatedUnionType type, AnnotatedTypeMirror p)
AnnotatedTypeVisitor
visitUnion
in interface AnnotatedTypeVisitor<R,AnnotatedTypeMirror>
visitUnion
in class AnnotatedTypeScanner<R,AnnotatedTypeMirror>
type
- the type to visitp
- a visitor-specified parameter