public class Interval extends Object
Constructor and Description |
---|
Interval(int... points)
Constructs a new Interval using the smallest and largest values in the
provided points.
|
Interval(Interval interval)
Copying constructor
|
Modifier and Type | Method and Description |
---|---|
int |
contains(int point) |
boolean |
equalsInterval(Interval other)
Check to see if another interval is the same as this interval.
|
boolean |
intersects(Interval other)
Determines if this interval has an intersection with another interval.
|
int |
max() |
int |
min() |
boolean |
setMax(int max)
Update the end position of this interval.
|
boolean |
setMin(int min)
Update the start position of this interval.
|
String |
toString() |
public Interval(int... points)
public Interval(Interval interval)
public boolean setMin(int min)
min > max
, sets max = min
.public boolean setMax(int max)
max < min
, sets min = max
.public int min()
public int max()
public int contains(int point)
public boolean intersects(Interval other)
public boolean equalsInterval(Interval other)
Copyright © 2015–2021 Fiji. All rights reserved.