Re-arranges, and adds additional logic to, the containsComponent in order to decrease runtime.
@@ -346,15 +346,19 @@ public class Screen extends Component {
return false;
}
- if (components.contains(component)) {
+ if (component instanceof Layer) {
+ if (layerComponents.contains(component)) {
return true;
}
+ }
- if (layerComponents.contains(component)) {
+ if (component instanceof Screen) {
+ if (screenComponents.contains(component)) {
return true;
}
+ }
- if (screenComponents.contains(component)) {
+ if (components.contains(component)) {
return true;
}
