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 immutablePolygonalChainthat 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 intdimension()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 anIllegalArgumentExceptionwill be thrown.- Parameters:
vertices- the vertices in the polygonal chain
-
-
Method Detail
-
dimension
public int dimension()
Description copied from interface:PolygonalChainGet the number of dimensions of this polygonal chain.- Specified by:
dimensionin interfacePolygonalChain- Returns:
- the number of dimensions of this chain
-
vertices
public List<Point> vertices()
Description copied from interface:PolygonalChainGet a list of the vertices defining the chain. All points must have the same dimension.- Specified by:
verticesin interfacePolygonalChain- Returns:
- the vertices defining the chain
-
-