public static class UBQualifier.LessThanLengthOf extends UBQualifier
UBQualifier.LessThanLengthOf, UBQualifier.UpperBoundUnknownQualifier
Modifier and Type | Method and Description |
---|---|
AnnotationMirror |
convertToAnnotation(ProcessingEnvironment env)
Returns the AnnotationMirror that represents this qualifier.
|
AnnotationMirror |
convertToSubstringIndexAnnotation(ProcessingEnvironment env)
Returns the @
SubstringIndexFor AnnotationMirror from the Substring Index
hierarchy that imposes the same upper bounds on the annotated expression as this
qualifier. |
UBQualifier |
divide(int divisor)
If divisor == 1, return this object.
|
boolean |
equals(Object o) |
Iterable<? extends String> |
getSequences() |
UBQualifier |
glb(UBQualifier other) |
int |
hashCode() |
boolean |
hasSequenceWithOffset(String sequence,
int offset)
Returns whether or not this qualifier has sequence with the specified offset.
|
boolean |
hasSequenceWithOffset(String sequence,
String offset)
Returns whether or not this qualifier has sequence with the specified offset.
|
boolean |
isLessThanLengthOf(String sequence)
Is a value with this type less than the length of the sequence?
|
boolean |
isLessThanLengthOfAny(List<String> sequences)
Is a value with this type less than the length of any of the sequences?
|
boolean |
isLessThanLengthQualifier() |
boolean |
isLessThanOrEqualTo(String sequence)
Is a value with this type less than or equal to the length of sequence?
|
boolean |
isSubtype(UBQualifier superType)
If superType is Unknown, return true.
|
boolean |
isValidReplacement(String sequence,
String replacementSequence,
UBQualifier.LessThanLengthOf other)
Checks whether replacing sequence with replacementSequence in this qualifier creates
replacementSequence entry in other.
|
boolean |
isValuePlusOffsetLessThanMinLen(String sequence,
long value,
int minlen) |
UBQualifier |
lub(UBQualifier other)
If other is Unknown, return Unknown.
|
UBQualifier |
minusOffset(int value)
Adds the negation of value as an offset to a copy of this qualifier.
|
UBQualifier |
minusOffset(Node node,
UpperBoundAnnotatedTypeFactory factory)
Adds node as a negative offset to a copy of this qualifier.
|
UBQualifier |
plusOffset(int value)
Adds value as an offset to a copy of this qualifier.
|
UBQualifier |
plusOffset(Node node,
UpperBoundAnnotatedTypeFactory factory)
Adds node as an offset to a copy of this qualifier.
|
UBQualifier |
removeOffset(String sequence,
int offset)
Generates a new UBQualifer without the given sequence and offset.
|
UBQualifier |
removeSequenceLengthAccess(List<String> sequences)
Returns a copy of this qualifier with sequence-offset pairs where in the original the
offset contains an access of an sequence length in
sequences . |
UBQualifier |
removeSequenceLengthAccessAndNeg1(List<String> sequences)
Returns a copy of this qualifier with sequence-offset pairs where in the original the
offset contains an access of an sequence length in
sequences . |
String |
toString() |
UBQualifier |
widenUpperBound(UBQualifier obj) |
createUBQualifier, createUBQualifier, createUBQualifier, createUBQualifier, createUBQualifier, createUBQualifier, isBottom, isPoly, isUnknown
public boolean hasSequenceWithOffset(String sequence, int offset)
UBQualifier
hasSequenceWithOffset
in class UBQualifier
sequence
- sequence expressionoffset
- the offset being looked forpublic boolean hasSequenceWithOffset(String sequence, String offset)
UBQualifier
hasSequenceWithOffset
in class UBQualifier
sequence
- sequence expressionoffset
- the offset being looked forpublic boolean isLessThanOrEqualTo(String sequence)
isLessThanOrEqualTo
in class UBQualifier
sequence
- a String sequencepublic boolean isLessThanLengthOfAny(List<String> sequences)
isLessThanLengthOfAny
in class UBQualifier
sequences
- list of sequencespublic boolean isLessThanLengthOf(String sequence)
isLessThanLengthOf
in class UBQualifier
sequence
- a String sequencepublic AnnotationMirror convertToAnnotation(ProcessingEnvironment env)
LTEqLengthOf
or @LTOMLengthOf
are returned.
Otherwise, @LTLengthOf
is used.
The returned annotation is canonicalized by sorting its arguments by sequence and then
offset. This is so that AnnotationUtils.areSame(AnnotationMirror,
AnnotationMirror)
returns true for equivalent annotations.
env
- a processing environment used to build the returned annotationpublic AnnotationMirror convertToSubstringIndexAnnotation(ProcessingEnvironment env)
SubstringIndexFor
AnnotationMirror from the Substring Index
hierarchy that imposes the same upper bounds on the annotated expression as this
qualifier. However, the upper bounds represented by this qualifier do not apply to the
value -1 which is always allowed by the returned annotation.env
- a processing environment used to build the returned annotationpublic boolean isLessThanLengthQualifier()
isLessThanLengthQualifier
in class UBQualifier
public boolean isSubtype(UBQualifier superType)
Otherwise, this qualifier must contain all the sequences in superType. For each the offsets for each sequence in superType, there must be an offset in this qualifier for the sequence that is greater than or equal to the super offset.
isSubtype
in class UBQualifier
superType
- other qualifierpublic UBQualifier lub(UBQualifier other)
Otherwise lub is computed as follows:
1. Create the intersection of the sets of arrays for this and other.
2. For each sequence in the intersection, get the offsets for this and other. If any offset in this is a less than or equal to an offset in other, then that offset is an offset for the sequence in lub. If any offset in other is a less than or equal to an offset in this, then that offset is an offset for the sequence in lub.
lub
in class UBQualifier
other
- to lub with thispublic UBQualifier widenUpperBound(UBQualifier obj)
widenUpperBound
in class UBQualifier
public UBQualifier glb(UBQualifier other)
glb
in class UBQualifier
public UBQualifier plusOffset(Node node, UpperBoundAnnotatedTypeFactory factory)
plusOffset
in class UBQualifier
node
- a Nodefactory
- AnnotatedTypeFactorypublic UBQualifier minusOffset(Node node, UpperBoundAnnotatedTypeFactory factory)
minusOffset
in class UBQualifier
node
- a Nodefactory
- AnnotatedTypeFactorypublic UBQualifier plusOffset(int value)
plusOffset
in class UBQualifier
value
- int value to addpublic UBQualifier minusOffset(int value)
value
to every offset equation in a copy of this object.minusOffset
in class UBQualifier
value
- int value to addpublic UBQualifier removeSequenceLengthAccess(List<String> sequences)
sequences
. The sequence length
access has been removed from the offset. If the original qualifier has no sequence length
offsets, then UNKNOWN is returned.sequences
- access of the length of these sequences are removedpublic UBQualifier removeSequenceLengthAccessAndNeg1(List<String> sequences)
sequences
. The sequence length
access has been removed from the offset. If the offset also has -1 then -1 is also
removed.sequences
- access of the length of these sequences are removedpublic UBQualifier divide(int divisor)
If divisor greater than 1, then return a copy of this object keeping only sequences and offsets where the offset is less than or equal to zero.
Otherwise, return UNKNOWN.
divisor
- number to divide bypublic boolean isValuePlusOffsetLessThanMinLen(String sequence, long value, int minlen)
public boolean isValidReplacement(String sequence, String replacementSequence, UBQualifier.LessThanLengthOf other)
public UBQualifier removeOffset(String sequence, int offset)