Package software.coley.sourcesolver.util
Record Class Range
java.lang.Object
java.lang.Record
software.coley.sourcesolver.util.Range
- Record Components:
begin- Start of range.end- End of range.
- All Implemented Interfaces:
Comparable<Range>
Simple range model.
- Author:
- Matt Coley
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintbegin()Returns the value of thebeginrecord component.intintend()Returns the value of theendrecord component.final booleanIndicates whether some other object is "equal to" this one.static RangeextractRange(com.sun.tools.javac.tree.EndPosTable table, Tree tree) static RangeextractRange(com.sun.tools.javac.tree.EndPosTable table, Collection<? extends Tree> trees) final inthashCode()Returns a hash code value for this object.booleanbooleanisWithin(int position) booleanisWithin(int position, boolean startInclusive, boolean endInclusive) final StringtoString()Returns a string representation of this record class.
-
Field Details
-
UNKNOWN
-
-
Constructor Details
-
Method Details
-
extractRange
@Nonnull public static Range extractRange(@Nonnull com.sun.tools.javac.tree.EndPosTable table, @Nonnull Tree tree) - Parameters:
table- Table to lookup tree positions within.tree- Tree to calculate range of.- Returns:
- Range covering tree.
-
extractRange
@Nonnull public static Range extractRange(@Nonnull com.sun.tools.javac.tree.EndPosTable table, @Nonnull Collection<? extends Tree> trees) - Parameters:
table- Table to lookup tree positions within.trees- Trees to calculate range of.- Returns:
- Range covering all trees.
-
isWithin
public boolean isWithin(int position) - Parameters:
position- Position to check.- Returns:
truewhen the position is in the inclusive range.
-
isWithin
public boolean isWithin(int position, boolean startInclusive, boolean endInclusive) - Parameters:
position- Position to check.startInclusive-truefor an inclusive lower bound.endInclusive-truefor an inclusive upper bound.- Returns:
truewhen the position is in the range.
-
isUnknown
public boolean isUnknown()- Returns:
truewhen the range has bogus values.
-
compareTo
- Specified by:
compareToin interfaceComparable<Range>
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
begin
public int begin()Returns the value of thebeginrecord component.- Returns:
- the value of the
beginrecord component
-
end
public int end()Returns the value of theendrecord component.- Returns:
- the value of the
endrecord component
-