11/***************************************************************************************************
22*
3- * Copyright (c) 2013, 2014, 2015, 2016, 2017 Universitat Politecnica de Valencia - www.upv.es
3+ * Copyright (c) 2013 - 2026 Universitat Politecnica de Valencia - www.upv.es
4+ * Copyright (c) 2018 - 2026 Open Universiteit - www.ou.nl
45*
56* Redistribution and use in source and binary forms, with or without
67* modification, are permitted provided that the following conditions are met:
2728* POSSIBILITY OF SUCH DAMAGE.
2829*******************************************************************************************************/
2930
30-
31- /**
32- * @author Sebastian Bauersfeld
33- */
3431package org .testar .monkey .alayer ;
3532
3633import org .testar .monkey .Assert ;
@@ -47,6 +44,14 @@ public static boolean intersect(Rect r1, Rect r2) {
4744 r2 .y () + r2 .height () < r1 .y ());
4845 }
4946
47+ public static boolean overlap (Rect r1 , Rect r2 ) {
48+ Assert .notNull (r1 , r2 );
49+ return !(r1 .x () + r1 .width () <= r2 .x () ||
50+ r1 .y () + r1 .height () <= r2 .y () ||
51+ r2 .x () + r2 .width () <= r1 .x () ||
52+ r2 .y () + r2 .height () <= r1 .y ());
53+ }
54+
5055 public static boolean contains (Rect r1 , Rect r2 ) {
5156 Assert .notNull (r1 , r2 );
5257 return r2 .x () >= r1 .x () && r2 .x () + r2 .width () <= r1 .x () + r1 .width () &&
@@ -102,7 +107,6 @@ public void paint(Canvas canvas, Pen pen) {
102107 canvas .rect (pen , x , y , width , height );
103108 }
104109
105- // by urueda
106110 @ Override
107111 public boolean equals (Object o ){
108112 if (o == this ) return true ;
0 commit comments