Package com.github.javaparser
Class Range
- java.lang.Object
-
- com.github.javaparser.Range
-
public class Range extends java.lang.ObjectA range of characters in a source file, from "begin" to "end", including the characters at "begin" and "end".
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(Position position)As strictlyContains, but a position that matches the begin or the end of this range is also considered contained one in each other.booleancontains(Range other)As strictlyContains, but two exactly matching ranges are also considered contained one in each other.booleanequals(java.lang.Object o)intgetLineCount()inthashCode()booleanisAfter(Position position)booleanisBefore(Position position)booleanoverlapsWith(Range other)Checks whether this Range overlaps with another Range.static Rangerange(int beginLine, int beginColumn, int endLine, int endColumn)static Rangerange(Position begin, Position end)booleanstrictlyContains(Position position)Does this strictly contain position.booleanstrictlyContains(Range other)Does this strictly contain other? It means that this has to be larger than other and it has to start before other and end after other.java.lang.StringtoString()RangewithBegin(Position begin)RangewithBeginColumn(int column)RangewithBeginLine(int line)RangewithEnd(Position end)RangewithEndColumn(int column)RangewithEndLine(int line)
-
-
-
Method Detail
-
range
public static Range range(int beginLine, int beginColumn, int endLine, int endColumn)
-
withBeginColumn
public Range withBeginColumn(int column)
-
withBeginLine
public Range withBeginLine(int line)
-
withEndColumn
public Range withEndColumn(int column)
-
withEndLine
public Range withEndLine(int line)
-
contains
public boolean contains(Range other)
As strictlyContains, but two exactly matching ranges are also considered contained one in each other.
-
contains
public boolean contains(Position position)
As strictlyContains, but a position that matches the begin or the end of this range is also considered contained one in each other.
-
strictlyContains
public boolean strictlyContains(Range other)
Does this strictly contain other? It means that this has to be larger than other and it has to start before other and end after other.
-
strictlyContains
public boolean strictlyContains(Position position)
Does this strictly contain position. It means that the position is after the begin of this range and before the end of this range.
-
overlapsWith
public boolean overlapsWith(Range other)
Checks whether this Range overlaps with another Range. If two ranges overlap, this range or the other range strictlyContains the begin or the end of the other range.
-
isBefore
public boolean isBefore(Position position)
-
isAfter
public boolean isAfter(Position position)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getLineCount
public int getLineCount()
-
-