public final class Shapes
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.util.Set<java.lang.Class<?>> |
dimensionalIntersection(Shape left,
Shape right)
Extracts those dimensions, which are contained in both shapes.
|
static Shape |
dimensionStripped(Shape shape,
java.util.Set<? extends java.lang.Class<?>> dimensionsToStrip)
Constructs a shape that contains positions, which are derived from the positions of the given shape by stripping
(removing) the given dimensions.
|
static Shape |
intersection(java.lang.Iterable<Shape> shapes)
Creates a shape, containing the positions which are contained in each of the given shapes.
|
static Shape |
intersection(Shape left,
Shape right)
Creates a shape, containing all the positions that are contained in both given shapes.
|
static Shape |
outerProduct(Shape left,
Shape right)
Constructs a shape that contains all positions resulting from the outer product of the positions of the left
shape with those of the right shape.
|
static java.util.Set<java.lang.Class<?>> |
parentDimensionalIntersection(Shape left,
Shape right) |
static Shape |
union(java.lang.Iterable<Shape> shapes)
Creates a shape, containing all the positions that are contained at least in one of the given shapes.
|
static Shape |
union(Shape left,
Shape right)
Creates a shape, containing all the positions that are either contained in the left or the right shape.This only
makes sense, if the dimensions of the two shapes are the same.
|
public static Shape intersection(Shape left, Shape right)
IllegalArgumentException
is
thrown.left
- the first shape from which to take positionsright
- the second shape from which to take positionspublic static Shape union(Shape left, Shape right)
IllegalArgumentException
is thrown.left
- the first shape from which to take positionsright
- the second shape from which to take positionspublic static final Shape union(java.lang.Iterable<Shape> shapes)
IllegalArgumentException
is thrown. Further, it is required that at least one element is contained in the
iterable.shapes
- the shapes for which the union shall be foundjava.lang.IllegalArgumentException
- if the shapes are not of the same dimensionjava.util.NoSuchElementException
- in case the iterable is emptyjava.lang.NullPointerException
- if the given iterable is null
public static final Shape intersection(java.lang.Iterable<Shape> shapes)
IllegalArgumentException
is
thrown. Further, it is required that at least one element is contained in the iterable.shapes
- the shapes for which the intersection shall be foundjava.lang.IllegalArgumentException
- if the shapes are not of the same dimensionjava.util.NoSuchElementException
- in case the iterable is emptyjava.lang.NullPointerException
- if the given iterable is null
public static java.util.Set<java.lang.Class<?>> dimensionalIntersection(Shape left, Shape right)
left
- the first shape for which to look at the dimensionsright
- the second shape where to look at the dimensions.public static java.util.Set<java.lang.Class<?>> parentDimensionalIntersection(Shape left, Shape right)
public static Shape dimensionStripped(Shape shape, java.util.Set<? extends java.lang.Class<?>> dimensionsToStrip)
shape
- the shape from which to extract the stripped positionsdimensionsToStrip
- the dimensions which shall be removed from the positions of the shapejava.lang.NullPointerException
- if one of the arguments are nullpublic static Shape outerProduct(Shape left, Shape right)
left
- the left shape to use for the outer productright
- the right shape to use for the outer productjava.lang.NullPointerException
- if one of the arguments is nulljava.lang.IllegalArgumentException
- if the two shapes have overlapping dimensions