Mega Code Archive

 
Categories / Java Tutorial / 2D Graphics
 

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