Package dev.nm.geometry.polyline
Class PolygonalChainByArray
- java.lang.Object
-
- dev.nm.geometry.polyline.PolygonalChainByArray
-
- All Implemented Interfaces:
PolygonalChain
public class PolygonalChainByArray extends Object implements PolygonalChain
An immutablePolygonalChain
that is backed by anArrayList
.
-
-
Constructor Summary
Constructors Constructor Description PolygonalChainByArray(List<? extends Point> vertices)
Create a new instance which uses the given vertices.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
dimension()
Get the number of dimensions of this polygonal chain.List<Point>
vertices()
Get a list of the vertices defining the chain.
-
-
-
Constructor Detail
-
PolygonalChainByArray
public PolygonalChainByArray(List<? extends Point> vertices)
Create a new instance which uses the given vertices. All vertices must have the same size or anIllegalArgumentException
will be thrown.- Parameters:
vertices
- the vertices in the polygonal chain
-
-
Method Detail
-
dimension
public int dimension()
Description copied from interface:PolygonalChain
Get the number of dimensions of this polygonal chain.- Specified by:
dimension
in interfacePolygonalChain
- Returns:
- the number of dimensions of this chain
-
vertices
public List<Point> vertices()
Description copied from interface:PolygonalChain
Get a list of the vertices defining the chain. All points must have the same dimension.- Specified by:
vertices
in interfacePolygonalChain
- Returns:
- the vertices defining the chain
-
-