@Test public void testEquals() { IVector2 a = Vector2.fromXY(10, 20); IVector2 b = Vector2.fromXY(30, 40); IVector2 c = Vector2.fromXY(80, 100); ILineSegment segmentA = LineSegment.fromPoints(a, b); ILineSegment segmentB = LineSegment.fromPoints(a, b); assertThat(segmentA, is(segmentB)); segmentB = LineSegment.fromPoints(b, a); assertThat(segmentA, not(segmentB)); segmentB = LineSegment.fromPoints(a, c); assertThat(segmentA, not(segmentB)); segmentB = LineSegment.fromPoints(c, b); assertThat(segmentA, not(segmentB)); }
@Override public final boolean equals(final Object other) { if (this == other) { return true; } if (!(other instanceof ILineSegment)) { return false; } final ILineSegment that = (ILineSegment) other; return getStart().equals(that.getStart()) && getEnd().equals(that.getEnd()); }
LineSegment extends ALine implements ILineSegment { @Override public final boolean equals(final Object other) { if (this == other) { return true; } if (!(other instanceof ILineSegment)) { return false; } final ILineSegment that = (ILineSegment) other; return getStart().equals(that.getStart()) && getEnd().equals(that.getEnd()); } }
LineSegment extends ALine implements ILineSegment { @Override public final boolean equals(final Object other) { if (this == other) { return true; } if (!(other instanceof ILineSegment)) { return false; } final ILineSegment that = (ILineSegment) other; return getStart().equals(that.getStart()) && getEnd().equals(that.getEnd()); } @SuppressWarnings("unused") private  LineSegment(); private  LineSegment(final IVector2 start, final IVector2 end); }
LineSegment extends ALine implements ILineSegment { @Override public final boolean equals(final Object other) { if (this == other) { return true; } if (!(other instanceof ILineSegment)) { return false; } final ILineSegment that = (ILineSegment) other; return getStart().equals(that.getStart()) && getEnd().equals(that.getEnd()); } @SuppressWarnings("unused") private  LineSegment(); private  LineSegment(final IVector2 start, final IVector2 end); static ILineSegment fromOffset(final IVector2 supportVector, final IVector2 offset); static ILineSegment fromPoints(final IVector2 start, final IVector2 end); @Override boolean isValid(); @Override final boolean equals(final Object other); @Override final int hashCode(); @Override IVector2 getStart(); @Override IVector2 getEnd(); @Override IVector2 getCenter(); @Override double getLength(); @Override IVector2 directionVector(); @Override IVector2 closestPointOnLine(final IVector2 point); @Override ILine toLine(); @Override IHalfLine toHalfLine(); @Override ILineSegment copy(); @Override Optional<IVector2> intersectLine(final ILine line); @Override Optional<IVector2> intersectHalfLine(final IHalfLine halfLine); @Override Optional<IVector2> intersectSegment(final ILineSegment other); @Override IVector2 stepAlongLine(final double stepSize); @Override ILineSegment withMargin(final double margin); @Override String toString(); @Override List<IVector2> getSteps(final double stepSize); }
LineSegment extends ALine implements ILineSegment { @Override public final boolean equals(final Object other) { if (this == other) { return true; } if (!(other instanceof ILineSegment)) { return false; } final ILineSegment that = (ILineSegment) other; return getStart().equals(that.getStart()) && getEnd().equals(that.getEnd()); } @SuppressWarnings("unused") private  LineSegment(); private  LineSegment(final IVector2 start, final IVector2 end); static ILineSegment fromOffset(final IVector2 supportVector, final IVector2 offset); static ILineSegment fromPoints(final IVector2 start, final IVector2 end); @Override boolean isValid(); @Override final boolean equals(final Object other); @Override final int hashCode(); @Override IVector2 getStart(); @Override IVector2 getEnd(); @Override IVector2 getCenter(); @Override double getLength(); @Override IVector2 directionVector(); @Override IVector2 closestPointOnLine(final IVector2 point); @Override ILine toLine(); @Override IHalfLine toHalfLine(); @Override ILineSegment copy(); @Override Optional<IVector2> intersectLine(final ILine line); @Override Optional<IVector2> intersectHalfLine(final IHalfLine halfLine); @Override Optional<IVector2> intersectSegment(final ILineSegment other); @Override IVector2 stepAlongLine(final double stepSize); @Override ILineSegment withMargin(final double margin); @Override String toString(); @Override List<IVector2> getSteps(final double stepSize);  }