|
TUM CCSM Commons | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.tum.cs.commons.region.Region
public final class Region
Regions represent intervals. Both the start and the end position are considered to be part of the region. Regions can i.e. be used to represent fragments of files.
This class is immutable.
Field Summary | |
---|---|
static java.lang.String |
UNKNOWN_ORIGIN
Name that is used if region is created without name |
Constructor Summary | |
---|---|
Region(int start,
int end)
Creates a region with an unknown origin |
|
Region(int start,
int end,
java.lang.String origin)
Creates a region with an origin |
Method Summary | |
---|---|
boolean |
adjacent(Region r)
Checks if two regions are adjacent |
int |
compareTo(Region compareTo)
Compares regions by their start position |
boolean |
containsPosition(int position)
Checks if the region contains a position |
int |
getEnd()
Gets the end position of the region |
int |
getLength()
Gets the length of the region |
java.lang.String |
getOrigin()
Get origin. |
int |
getStart()
Gets the start position of the region |
boolean |
overlaps(Region r)
Checks if two regions are overlapping |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String UNKNOWN_ORIGIN
Constructor Detail |
---|
public Region(int start, int end, java.lang.String origin)
start
- Start position of the regionend
- End position of the regionorigin
- Region origin. (i.e. region producer)public Region(int start, int end)
start
- Start position of the regionend
- End position of the regionMethod Detail |
---|
public boolean containsPosition(int position)
public boolean overlaps(Region r)
public boolean adjacent(Region r)
public java.lang.String getOrigin()
public int getEnd()
public int getStart()
public int getLength()
public java.lang.String toString()
toString
in class java.lang.Object
public int compareTo(Region compareTo)
compareTo
in interface java.lang.Comparable<Region>
|
TUM CCSM Commons | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |