diff options
author | Sven Gothel <[email protected]> | 2010-11-06 06:17:41 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-11-06 06:17:41 +0100 |
commit | 8df147c4a1d7e2e5d63416a1bee979be858440d0 (patch) | |
tree | 32709ce1ce9c6c00ed806e61e36ad896b1862dd2 /src/newt | |
parent | 1be7b5271ec1d08b6929a88dd811754d33d149de (diff) |
Added fast path to equals impl.
Diffstat (limited to 'src/newt')
4 files changed, 4 insertions, 1 deletions
diff --git a/src/newt/classes/com/jogamp/newt/Display.java b/src/newt/classes/com/jogamp/newt/Display.java index 71ea12ad8..bec014c0b 100644 --- a/src/newt/classes/com/jogamp/newt/Display.java +++ b/src/newt/classes/com/jogamp/newt/Display.java @@ -44,6 +44,7 @@ public abstract class Display { /** return true if obj is of type Display and both FQN {@link #getFQName()} equals */ public boolean equals(Object obj) { + if (this == obj) { return true; } if (obj instanceof Display) { Display d = (Display)obj; return d.getFQName().equals(getFQName()); diff --git a/src/newt/classes/com/jogamp/newt/Screen.java b/src/newt/classes/com/jogamp/newt/Screen.java index fc91047c0..d7d6baea7 100644 --- a/src/newt/classes/com/jogamp/newt/Screen.java +++ b/src/newt/classes/com/jogamp/newt/Screen.java @@ -49,6 +49,7 @@ public abstract class Screen { /** return true if obj is of type Display and both FQN {@link #getFQName()} equals */ public boolean equals(Object obj) { + if (this == obj) { return true; } if (obj instanceof Screen) { Screen s = (Screen)obj; return s.getFQName().equals(getFQName()); diff --git a/src/newt/classes/com/jogamp/newt/ScreenMode.java b/src/newt/classes/com/jogamp/newt/ScreenMode.java index f87c41240..81ce70249 100644 --- a/src/newt/classes/com/jogamp/newt/ScreenMode.java +++ b/src/newt/classes/com/jogamp/newt/ScreenMode.java @@ -164,6 +164,7 @@ public class ScreenMode implements Cloneable { * <br> */ public final boolean equals(Object obj) { + if (this == obj) { return true; } if (obj instanceof ScreenMode) { ScreenMode sm = (ScreenMode)obj; return sm.getMonitorMode().equals(getMonitorMode()) && diff --git a/src/newt/classes/com/jogamp/newt/util/MonitorMode.java b/src/newt/classes/com/jogamp/newt/util/MonitorMode.java index 7f989e4ab..fb2d0ceb5 100644 --- a/src/newt/classes/com/jogamp/newt/util/MonitorMode.java +++ b/src/newt/classes/com/jogamp/newt/util/MonitorMode.java @@ -1,6 +1,5 @@ /** * Copyright 2010 JogAmp Community. All rights reserved. - * Copyright (c) 2010 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -85,6 +84,7 @@ public class MonitorMode implements Cloneable { * otherwise <code>false</code>. */ public final boolean equals(Object obj) { + if (this == obj) { return true; } if (obj instanceof MonitorMode) { MonitorMode p = (MonitorMode)obj; return getSurfaceSize().equals(p.getSurfaceSize()) && |