@Test public void testEquals() { IVector2 sV = Vector2.fromXY(10, 20); IVector2 dV = Vector2.fromXY(Math.PI, Math.E); IHalfLine halfLine = HalfLine.fromDirection(sV, dV); assertThat(halfLine, is(halfLine)); assertThat(halfLine.hashCode(), is(halfLine.hashCode())); IHalfLine other = HalfLine.fromDirection(sV, dV.multiplyNew(-1.0d)); assertThat(halfLine, not(other)); }
@Override public boolean equals(final Object other) { if (this == other) return true; if (other == null || !(other instanceof IHalfLine)) return false; final IHalfLine that = (IHalfLine) other; return this.supportVector().equals(that.supportVector()) && this.directionVector().equals(that.directionVector()); }
HalfLine extends AUnboundedLine implements IHalfLine { @Override public boolean equals(final Object other) { if (this == other) return true; if (other == null || !(other instanceof IHalfLine)) return false; final IHalfLine that = (IHalfLine) other; return this.supportVector().equals(that.supportVector()) && this.directionVector().equals(that.directionVector()); } }
HalfLine extends AUnboundedLine implements IHalfLine { @Override public boolean equals(final Object other) { if (this == other) return true; if (other == null || !(other instanceof IHalfLine)) return false; final IHalfLine that = (IHalfLine) other; return this.supportVector().equals(that.supportVector()) && this.directionVector().equals(that.directionVector()); } private  HalfLine(final IVector2 supportVector, final IVector2 directionVector); }
HalfLine extends AUnboundedLine implements IHalfLine { @Override public boolean equals(final Object other) { if (this == other) return true; if (other == null || !(other instanceof IHalfLine)) return false; final IHalfLine that = (IHalfLine) other; return this.supportVector().equals(that.supportVector()) && this.directionVector().equals(that.directionVector()); } private  HalfLine(final IVector2 supportVector, final IVector2 directionVector); static IHalfLine fromDirection(final IVector2 supportVector, final IVector2 directionVector); @Override boolean equals(final Object other); @Override int hashCode(); @Override IVector2 closestPointOnLine(final IVector2 point); @Override ILine toLine(); @Override IHalfLine copy(); @Override Optional<IVector2> intersectLine(final ILine line); @Override Optional<IVector2> intersectHalfLine(final IHalfLine other); @Override Optional<IVector2> intersectSegment(final ILineSegment segment); @Override boolean isPointInFront(final IVector2 point); @Override String toString(); }
HalfLine extends AUnboundedLine implements IHalfLine { @Override public boolean equals(final Object other) { if (this == other) return true; if (other == null || !(other instanceof IHalfLine)) return false; final IHalfLine that = (IHalfLine) other; return this.supportVector().equals(that.supportVector()) && this.directionVector().equals(that.directionVector()); } private  HalfLine(final IVector2 supportVector, final IVector2 directionVector); static IHalfLine fromDirection(final IVector2 supportVector, final IVector2 directionVector); @Override boolean equals(final Object other); @Override int hashCode(); @Override IVector2 closestPointOnLine(final IVector2 point); @Override ILine toLine(); @Override IHalfLine copy(); @Override Optional<IVector2> intersectLine(final ILine line); @Override Optional<IVector2> intersectHalfLine(final IHalfLine other); @Override Optional<IVector2> intersectSegment(final ILineSegment segment); @Override boolean isPointInFront(final IVector2 point); @Override String toString();  }