public class Interval extends Object implements Intervalable
| Constructor and Description |
|---|
Interval(int start,
int end)
构造一个区间
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Object o) |
boolean |
equals(Object o) |
int |
getEnd()
终点
|
int |
getStart()
起点
|
int |
hashCode() |
boolean |
overlapsWith(int point)
区间是否覆盖了这个点
|
boolean |
overlapsWith(Interval other)
是否与另一个区间交叉(有一部分重叠)
|
int |
size()
长度
|
String |
toString() |
public int getStart()
IntervalablegetStart in interface Intervalablepublic int getEnd()
IntervalablegetEnd in interface Intervalablepublic int size()
Intervalablesize in interface Intervalablepublic boolean overlapsWith(Interval other)
other - public boolean overlapsWith(int point)
point - public int compareTo(Object o)
compareTo in interface ComparableCopyright © 2014–2021 码农场. All rights reserved.