lingua-franca 0.10.1
Lingua Franca code generator
Loading...
Searching...
No Matches
org.lflang.generator.Range Class Reference

Represents a range in a document. More...

Inherits Comparable< Range >.

Public Member Functions

int compareTo (Range o)
 Compares this to o.
boolean contains (Position p)
 Returns whether this contains p.
boolean equals (Object o)
Position getEndExclusive ()
 Returns the Position that immediately follows the last Position in this Range.
Position getStartInclusive ()
 Returns the first Position that is included in this Range.
int hashCode ()
 Range (Position startInclusive, Position endExclusive)
 Initializes a Range that starts at startInclusive and ends at, but does not include, endExclusive.
String toString ()

Static Public Member Functions

static Range degenerateRange (Position p)
 Returns the degenerate range that simply describes the exact location specified by p.
static Range fromString (String s)
 Converts s to a Range.
static Range fromString (String s, Position relativeTo)
 Converts s to a Range, with the assumption that the positions expressed in s are given relative to relativeTo.

Static Public Attributes

static final Pattern PATTERN

Detailed Description

Represents a range in a document.

Ranges have a natural ordering that respects their start position(s) only.

Constructor & Destructor Documentation

◆ Range()

org.lflang.generator.Range.Range ( Position startInclusive,
Position endExclusive )

Initializes a Range that starts at startInclusive and ends at, but does not include, endExclusive.

Parameters
startInclusivethe start of the range (inclusive)
endExclusivethe end of the range (exclusive)

Member Function Documentation

◆ compareTo()

int org.lflang.generator.Range.compareTo ( Range o)

Compares this to o.

Parameters
oanother Range
Returns
an integer indicating how this compares to o

◆ contains()

boolean org.lflang.generator.Range.contains ( Position p)

Returns whether this contains p.

Parameters
pan arbitrary Position
Returns
whether this contains p

◆ degenerateRange()

Range org.lflang.generator.Range.degenerateRange ( Position p)
static

Returns the degenerate range that simply describes the exact location specified by p.

Parameters
pan arbitrary Position
Returns
a Range that starts and ends immediately before p

◆ equals()

boolean org.lflang.generator.Range.equals ( Object o)

◆ fromString() [1/2]

Range org.lflang.generator.Range.fromString ( String s)
static

Converts s to a Range.

Parameters
sa String that represents a Range, formatted like the output of Range.toString
Returns
the Range r such that r.toString() equals s

◆ fromString() [2/2]

Range org.lflang.generator.Range.fromString ( String s,
Position relativeTo )
static

Converts s to a Range, with the assumption that the positions expressed in s are given relative to relativeTo.

Parameters
sa String that represents a Range, formatted like the output of Range.toString
relativeTothe position relative to which the positions in s are represented
Returns
the Range represented by s, expressed relative to the Position relative to which the Position relativeTo is expressed

◆ getEndExclusive()

Position org.lflang.generator.Range.getEndExclusive ( )

Returns the Position that immediately follows the last Position in this Range.

Returns
the Position that immediately follows the last Position in this Range

◆ getStartInclusive()

Position org.lflang.generator.Range.getStartInclusive ( )

Returns the first Position that is included in this Range.

Returns
the first Position that is included in this Range

◆ hashCode()

int org.lflang.generator.Range.hashCode ( )

◆ toString()

String org.lflang.generator.Range.toString ( )

Member Data Documentation

◆ PATTERN

final Pattern org.lflang.generator.Range.PATTERN
static
Initial value:
=
Pattern.compile(
String.format(
"Range: \\[(?<start>%s), (?<end>%s)\\)",
A position in a document, including line and column.
Definition Position.java:13
static final Pattern PATTERN
Definition Position.java:14
static String removeNamedCapturingGroups(Pattern regex)
Remove the names from the named capturing groups that appear in regex.
Definition Position.java:219

The documentation for this class was generated from the following file:
  • /Users/runner/work/lingua-franca/lingua-franca/core/src/main/java/org/lflang/generator/Range.java