001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: /**
018: * @author Alexey A. Petrenko
019: * @version $Revision$
020: */package java.awt;
021:
022: public final class DisplayMode {
023: private final int width;
024:
025: private final int height;
026:
027: private final int bitDepth;
028:
029: private final int refreshRate;
030:
031: /***************************************************************************
032: *
033: * Constants
034: *
035: ***************************************************************************/
036:
037: public static final int BIT_DEPTH_MULTI = -1;
038:
039: public static final int REFRESH_RATE_UNKNOWN = 0;
040:
041: /***************************************************************************
042: *
043: * Constructors
044: *
045: ***************************************************************************/
046:
047: public DisplayMode(int width, int height, int bitDepth,
048: int refreshRate) {
049: this .width = width;
050: this .height = height;
051: this .bitDepth = bitDepth;
052: this .refreshRate = refreshRate;
053: }
054:
055: /***************************************************************************
056: *
057: * Public methods
058: *
059: ***************************************************************************/
060:
061: @Override
062: public boolean equals(Object dm) {
063: if (dm instanceof DisplayMode) {
064: return equals((DisplayMode) dm);
065: }
066: return false;
067: }
068:
069: public boolean equals(DisplayMode dm) {
070: if (dm == null) {
071: return false;
072: }
073: if (dm.bitDepth != bitDepth) {
074: return false;
075: }
076: if (dm.refreshRate != refreshRate) {
077: return false;
078: }
079: if (dm.width != width) {
080: return false;
081: }
082: if (dm.height != height) {
083: return false;
084: }
085: return true;
086: }
087:
088: public int getBitDepth() {
089: return bitDepth;
090: }
091:
092: public int getHeight() {
093: return height;
094: }
095:
096: public int getRefreshRate() {
097: return refreshRate;
098: }
099:
100: public int getWidth() {
101: return width;
102: }
103: }
|