@Test public void testEquals() { IVector2 sV = Vector2.fromXY(10, 20); IVector2 dV = Vector2.fromAngle(Math.PI / 4); IVector2 orthogonalDV = dV.turnNew(Math.PI / 2); IVector2 oppositeDV = dV.turnNew(Math.PI); ILine line = Line.fromDirection(sV, dV); assertThat(line, is(line)); assertNotSame(line, null); assertThat(line, not(new Object())); assertThat(line.hashCode(), is(line.hashCode())); ILine other = Line.fromDirection(sV, dV); assertThat(line, is(other)); assertThat(line.hashCode(), is(other.hashCode())); other = Line.fromDirection(sV.multiplyNew(-1.0d), dV); assertThat(line, not(other)); other = Line.fromDirection(sV, orthogonalDV); assertThat(line, not(other)); other = Line.fromDirection(sV, oppositeDV); assertThat(line, is(other)); assertThat(line.hashCode(), is(other.hashCode())); other = Line.fromDirection(sV.addNew(dV), dV); assertThat(line, is(other)); assertThat(line.hashCode(), is(other.hashCode())); }
@Override public final boolean equals(final Object other) { if (this == other) { return true; } if (other == null || !(other instanceof ILine)) { return false; } final ILine that = (ILine) other; if (this.isValid() && that.isValid()) { return equalsForValid(this, that); } return equalsForInvalid(this, that); }
Line extends AUnboundedLine implements ILine { @Override public final boolean equals(final Object other) { if (this == other) { return true; } if (other == null || !(other instanceof ILine)) { return false; } final ILine that = (ILine) other; if (this.isValid() && that.isValid()) { return equalsForValid(this, that); } return equalsForInvalid(this, that); } }
Line extends AUnboundedLine implements ILine { @Override public final boolean equals(final Object other) { if (this == other) { return true; } if (other == null || !(other instanceof ILine)) { return false; } final ILine that = (ILine) other; if (this.isValid() && that.isValid()) { return equalsForValid(this, that); } return equalsForInvalid(this, that); } private  Line(final IVector2 supportVector, final IVector2 directionVector); }
Line extends AUnboundedLine implements ILine { @Override public final boolean equals(final Object other) { if (this == other) { return true; } if (other == null || !(other instanceof ILine)) { return false; } final ILine that = (ILine) other; if (this.isValid() && that.isValid()) { return equalsForValid(this, that); } return equalsForInvalid(this, that); } private  Line(final IVector2 supportVector, final IVector2 directionVector); static ILine fromPoints(final IVector2 supportPointA, final IVector2 supportPointB); static ILine fromDirection(final IVector2 supportVector, final IVector2 directionVector); @Override ILine copy(); @Override final boolean equals(final Object other); @Override final int hashCode(); @Override Optional<Double> getYIntercept(); @Override Optional<Double> getXValue(final double y); @Override Optional<Double> getYValue(final double x); @Override ILine getOrthogonalLine(); @Override IVector2 closestPointOnLine(final IVector2 point); @Override ILine toLine(); @Override Optional<IVector2> intersectLine(final ILine other); @Override Optional<IVector2> intersectHalfLine(final IHalfLine halfLine); @Override Optional<IVector2> intersectSegment(final ILineSegment segment); @Override String toString(); }
Line extends AUnboundedLine implements ILine { @Override public final boolean equals(final Object other) { if (this == other) { return true; } if (other == null || !(other instanceof ILine)) { return false; } final ILine that = (ILine) other; if (this.isValid() && that.isValid()) { return equalsForValid(this, that); } return equalsForInvalid(this, that); } private  Line(final IVector2 supportVector, final IVector2 directionVector); static ILine fromPoints(final IVector2 supportPointA, final IVector2 supportPointB); static ILine fromDirection(final IVector2 supportVector, final IVector2 directionVector); @Override ILine copy(); @Override final boolean equals(final Object other); @Override final int hashCode(); @Override Optional<Double> getYIntercept(); @Override Optional<Double> getXValue(final double y); @Override Optional<Double> getYValue(final double x); @Override ILine getOrthogonalLine(); @Override IVector2 closestPointOnLine(final IVector2 point); @Override ILine toLine(); @Override Optional<IVector2> intersectLine(final ILine other); @Override Optional<IVector2> intersectHalfLine(final IHalfLine halfLine); @Override Optional<IVector2> intersectSegment(final ILineSegment segment); @Override String toString();  }