MCPcopy Create free account
hub / github.com/MailCore/mailcore2 / Range

Class Range

src/java/com/libmailcore/Range.java:4–43  ·  view source on GitHub ↗

Range of integer values.

Source from the content-addressed store, hash-verified

2
3/** Range of integer values. */
4public class Range {
5 /** Location. */
6 public long location;
7 /** Length of the range. A length of 0 is a range with only one item: the location. */
8 public long length;
9
10 /** When using RangeMax as the length of the range, it means that the range is infinite. */
11 static public long RangeMax = 1 >> 63 - 1;
12
13 /** Constructor for a range starting at 0 and of length 0. */
14 public Range() {}
15 /** Constructor */
16 public Range(long aLocation, long aLength)
17 {
18 location = aLocation;
19 length = aLength;
20 }
21
22 /** Subtract otherRange from this range and returns the resulting set of indexes. */
23 public native IndexSet removeRange(Range otherRange);
24 /** Union of otherRange and this range and returns the resulting set of indexes. */
25 public native IndexSet union(Range otherRange);
26 /** Returns the range resulting from the intersection. */
27 public native Range intersection(Range otherRange);
28 /** Returns whether the intersection is non-empty. */
29 public native boolean hasIntersection(Range otherRange);
30 /** Returns the included left bound of the range. */
31 public native long leftBound();
32 /** Returns the included right bound of the range. */
33 public native long rightBound();
34 /** Returns a string representation of range. */
35 public native String toString();
36
37 /** Create a range using a string representation. */
38 public static native Range rangeWithString(String rangeString);
39
40 static {
41 MainThreadUtils.singleton();
42 }
43}

Callers

nothing calls this directly

Calls 1

singletonMethod · 0.95

Tested by

no test coverage detected