Compares two arcs and returns true if they are equal or both null. : Arc « 2D Graphics « Java Tutorial






import java.awt.geom.Arc2D;

public class Main {



  /**
   * Compares two arcs and returns <code>true</code> if they are equal or
   * both <code>null</code>.
   *
   * @param a1  the first arc (<code>null</code> permitted).
   * @param a2  the second arc (<code>null</code> permitted).
   *
   * @return A boolean.
   */
  public static boolean equal(final Arc2D a1, final Arc2D a2) {
      if (a1 == null) {
          return (a2 == null);
      }
      if (a2 == null) {
          return false;
      }
      if (!a1.getFrame().equals(a2.getFrame())) {
          return false;
      }
      if (a1.getAngleStart() != a2.getAngleStart()) {
          return false;
      }
      if (a1.getAngleExtent() != a2.getAngleExtent()) {
          return false;
      }
      if (a1.getArcType() != a2.getArcType()) {
          return false;
      }
      return true;
  }

}








16.9.Arc
16.9.1.Draw ArcDraw Arc
16.9.2.Fill ArcFill Arc
16.9.3.Arc2D PIEArc2D PIE
16.9.4.Arc2D OPENArc2D OPEN
16.9.5.Arc2D ChordArc2D Chord
16.9.6.Drawing a Pie Chart
16.9.7.Compares two arcs and returns true if they are equal or both null.