@Override public boolean equals(final Object obj) { return obj instanceof RealPointCollection && // RealPointCollection.equals(this, (RealPointCollection<?>) obj); }
@Override public int hashCode() { return RealPointCollection.hashCode( this ); } }
/** * Determines whether two point collections describe the same region. * <p> * Two point collections are equal iff they have the same dimensionality and * vertices. * </p> * * @param points1 * The first point collection to compare. * @param points2 * The second point collection to compare. * @return True iff the point collections describe the same region. */ static boolean equals( final RealPointCollection< ? > points1, final RealPointCollection< ? > points2 ) { if ( points1 == null && points2 == null ) return true; if ( points1 == null || points2 == null || !Masks.sameTypesAndDimensions( points1, points2 ) || points1.size() != points2.size() ) return false; for ( final RealLocalizable p : points1.points() ) { if ( !points2.test( p ) ) return false; } return true; } }
/** * Computes a hash code for a point collection. The hash code value is based * on the point positions. * * @param points * The point collection for which to compute the hash code. * @return Hash code of the point collection. */ static int hashCode( final RealPointCollection< ? > points ) { int result = 71; for ( RealLocalizable l : points.points() ) for ( int d = 0; d < l.numDimensions(); d++ ) result += 3 * l.getDoublePosition( d ); return result; }
@Override public PointRoi convert(final RealPointCollection<RealLocalizable> mask) { final Iterator<RealLocalizable> points = mask.points().iterator(); RealLocalizable point = points.next(); final PointRoi pointRoi = new PointRoi(point.getDoublePosition(0), point .getDoublePosition(1)); while (points.hasNext()) { point = points.next(); pointRoi.addPoint(point.getDoublePosition(0), point.getDoublePosition(1)); } return pointRoi; }
@Override public int hashCode() { return RealPointCollection.hashCode( this ); }
@Override public boolean equals( final Object obj ) { return obj instanceof RealPointCollection && RealPointCollection.equals( this, ( RealPointCollection< ? > ) obj ); }
@Override public int hashCode() { return RealPointCollection.hashCode(this); }
@Override public boolean equals( final Object obj ) { return obj instanceof RealPointCollection && RealPointCollection.equals( this, ( RealPointCollection< ? > ) obj ); }