jdk/src/java.desktop/share/classes/java/awt/DisplayMode.java
changeset 41793 7b9c71553d63
parent 35667 ed476aba94de
equal deleted inserted replaced
41792:8b032394d44e 41793:7b9c71553d63
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   140     }
   140     }
   141 
   141 
   142     /**
   142     /**
   143      * {@inheritDoc}
   143      * {@inheritDoc}
   144      */
   144      */
       
   145     @Override
   145     public boolean equals(Object dm) {
   146     public boolean equals(Object dm) {
   146         if (dm instanceof DisplayMode) {
   147         if (dm instanceof DisplayMode) {
   147             return equals((DisplayMode)dm);
   148             return equals((DisplayMode)dm);
   148         } else {
   149         } else {
   149             return false;
   150             return false;
   151     }
   152     }
   152 
   153 
   153     /**
   154     /**
   154      * {@inheritDoc}
   155      * {@inheritDoc}
   155      */
   156      */
       
   157     @Override
   156     public int hashCode() {
   158     public int hashCode() {
   157         return getWidth() + getHeight() + getBitDepth() * 7
   159         return getWidth() + getHeight() + getBitDepth() * 7
   158             + getRefreshRate() * 13;
   160             + getRefreshRate() * 13;
   159     }
   161     }
   160 
   162 
       
   163     /**
       
   164      * {@inheritDoc}
       
   165      */
       
   166     @Override
       
   167     public String toString() {
       
   168         return getWidth() + "x" + getHeight() + "x" +
       
   169                (getBitDepth() > 0 ? getBitDepth() + "bpp": "[Multi depth]")
       
   170                + "@" + (getRefreshRate() > 0 ? getRefreshRate() + "Hz" :
       
   171                "[Unknown refresh rate]");
       
   172     }
   161 }
   173 }