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






Compares two arcs and returns true if they are equal or both null.

 

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;
  }

}

   
  








Related examples in the same category

1.Draw draw an arc outline
2.Fill an arc outline
3.Arc2D.Float: Arc2D.OPEN
4.Arc2D.CHORD
5.Arc2D.PIE