public class Boundary extends Object
Modifier and Type | Field and Description |
---|---|
static Boundary |
EMPTY
Represents an empty 1D boundary object.
|
Constructor and Description |
---|
Boundary(double... values)
Constructs an object using given values to calculate the minimum and maximum values.
|
Modifier and Type | Method and Description |
---|---|
Boundary |
add(Boundary delta)
Adding the given value to the interval and creates a new Boundary object with the new values.
|
Boundary |
add(double delta)
Adding the given value to the interval and creates a new Boundary object with the new values.
|
static Boundary |
combine(Collection<Boundary> boundaries)
Creates a Boundary object which will hold the minimum and maximum values
from the given collection.
|
static Boundary |
createSymmetricBoundary(double value)
Creates a Boundary object which has the given maximum value and the middle is zero.
|
double |
getMax()
Returns with the calculated maximum value.
|
double |
getMiddle()
Returns the middle point of the interval.
|
double |
getMin()
Returns with the calculated minimum value.
|
double |
getSize()
Returns with the size of the interval.
|
static Boundary |
intersect(Collection<Boundary> boundaries)
Creates a Boundary object which will hold the minimum and maximum values
from the given collection.
|
boolean |
isInside(double value)
Returns true if and only if the given value is within this boundaries limits.
|
boolean |
isInsideOf(Boundary b)
Returns true if and only if this boundary is inside of the given boundary.
|
Boundary |
negate(boolean doNegate)
Negate the current object if the parameter is true, but this object
will be unchanged: a new one will be created with the new values.
|
Boundary |
remove(Boundary b)
Removes the values of the given boundary from this boundary and returns with the remaining values.
|
Boundary |
scale(double delta)
Multiplying the interval with the given value, basically scaling it.
|
public static final Boundary EMPTY
public Boundary(double... values)
values
- the values used by the calculationpublic static Boundary combine(Collection<Boundary> boundaries)
boundaries
- the collections which should be consideredpublic static Boundary intersect(Collection<Boundary> boundaries) throws IllegalValueException
boundaries
- the collections which should be consideredIllegalValueException
- if the given boundaries does not have a common interval or if
the given list is emptypublic static Boundary createSymmetricBoundary(double value)
value
- the maximum value of the Boundarypublic Boundary negate(boolean doNegate)
Negate the current object if the parameter is true, but this object will be unchanged: a new one will be created with the new values. This means the new objects maximum value will be equals this object's minimum value negated - the same is true for the minimum value.
If the parameter is false this method returns with this object and does nothing.
doNegate
- this is the controlling parameterpublic double getMin()
public double getMax()
public double getMiddle()
public double getSize()
public Boundary add(double delta)
delta
- the value to move this intervalpublic Boundary add(Boundary delta)
delta
- the value to add to this intervalpublic Boundary remove(Boundary b) throws IllegalValueException
b
- the boundary to be removedIllegalValueException
- if there is nothing leftpublic Boundary scale(double delta)
delta
- the value used by the multiplicationpublic boolean isInsideOf(Boundary b)
b
- the given boundarypublic boolean isInside(double value)
value
- the given valueCopyright © 2014–2020, Printing in 3D. All rights reserved.