@Test public void testThatCalculateMedianReferencePointDistanceReturnsTheCorrectCalculatedDistance() { PointList pl = new PointList(new XYPointFactory(), pointsXY); NicGeoPoint referencePoint = new XYPoint(); referencePoint.setXY(3, 10); assertEquals(5.1, pl.calculateMedianReferencePointDistance(referencePoint), delta); }
public double calculateMedianReferencePointDistance(final T referencePoint) { final List<Double> referencePointDistances = new ArrayList<Double>(); for (final T point : this) { referencePointDistances.add(point.calculateDistanceTo(referencePoint)); } Collections.sort(referencePointDistances); final double medianReferencePointDistance = getMedianFromSortedList(referencePointDistances); return medianReferencePointDistance; }
PointList extends ArrayList<T> { public double calculateMedianReferencePointDistance(final T referencePoint) { final List<Double> referencePointDistances = new ArrayList<Double>(); for (final T point : this) { referencePointDistances.add(point.calculateDistanceTo(referencePoint)); } Collections.sort(referencePointDistances); final double medianReferencePointDistance = getMedianFromSortedList(referencePointDistances); return medianReferencePointDistance; } }
PointList extends ArrayList<T> { public double calculateMedianReferencePointDistance(final T referencePoint) { final List<Double> referencePointDistances = new ArrayList<Double>(); for (final T point : this) { referencePointDistances.add(point.calculateDistanceTo(referencePoint)); } Collections.sort(referencePointDistances); final double medianReferencePointDistance = getMedianFromSortedList(referencePointDistances); return medianReferencePointDistance; } PointList(PointFactory factory);  PointList(PointFactory factory, final Collection<T> geoPoints); }
PointList extends ArrayList<T> { public double calculateMedianReferencePointDistance(final T referencePoint) { final List<Double> referencePointDistances = new ArrayList<Double>(); for (final T point : this) { referencePointDistances.add(point.calculateDistanceTo(referencePoint)); } Collections.sort(referencePointDistances); final double medianReferencePointDistance = getMedianFromSortedList(referencePointDistances); return medianReferencePointDistance; } PointList(PointFactory factory);  PointList(PointFactory factory, final Collection<T> geoPoints); double calculateMedianReferencePointDistance(final T referencePoint); T getMedianPoint(); T getAveragePoint(); double getAverageX(); double getAverageY(); double getMedianX(); double getMedianY(); List<Double> getXValues(); List<Double> getYValues(); @Override void clear(); @Override boolean add(final T geoPoint); @Override void add(int index, T element); @Override boolean addAll(Collection<? extends T> c); @Override boolean addAll(int index, Collection<? extends T> c); @Override T remove(int index); @Override boolean remove(Object o); @Override T set(int index, T element); @Override boolean removeAll(Collection<?> c); @Override boolean retainAll(Collection<?> c); }
PointList extends ArrayList<T> { public double calculateMedianReferencePointDistance(final T referencePoint) { final List<Double> referencePointDistances = new ArrayList<Double>(); for (final T point : this) { referencePointDistances.add(point.calculateDistanceTo(referencePoint)); } Collections.sort(referencePointDistances); final double medianReferencePointDistance = getMedianFromSortedList(referencePointDistances); return medianReferencePointDistance; } PointList(PointFactory factory);  PointList(PointFactory factory, final Collection<T> geoPoints); double calculateMedianReferencePointDistance(final T referencePoint); T getMedianPoint(); T getAveragePoint(); double getAverageX(); double getAverageY(); double getMedianX(); double getMedianY(); List<Double> getXValues(); List<Double> getYValues(); @Override void clear(); @Override boolean add(final T geoPoint); @Override void add(int index, T element); @Override boolean addAll(Collection<? extends T> c); @Override boolean addAll(int index, Collection<? extends T> c); @Override T remove(int index); @Override boolean remove(Object o); @Override T set(int index, T element); @Override boolean removeAll(Collection<?> c); @Override boolean retainAll(Collection<?> c);  }