/** * Create an instance of {@link Coordinate } * */ public Coordinate createCoordinate() { return new Coordinate(); }
private static List<Coordinate> checkAndcreateCoordinates(final Object container, int... shape) { if ((container == null) || (shape == null)) { throw new WebLabUncheckedException("Argument was null."); } if (shape.length % 2 != 0) { throw new WebLabUncheckedException("Coordinate array not valid (should be of an even length)."); } if (shape.length < 4) { throw new WebLabUncheckedException("Not enought coordinates in the shape array (at least two points should be described, i.e. 4 int)."); } final List<Coordinate> coordinates = new LinkedList<Coordinate>(); for (int i = 0; i < shape.length / 2; i++) { final Coordinate coordoI = new Coordinate(); coordoI.setX(shape[2 * i]); coordoI.setY(shape[2 * i + 1]); coordinates.add(coordoI); } return coordinates; }