001: /*
002: * File : $Source: /usr/local/cvs/opencms/src/org/opencms/util/A_CmsModeIntEnumeration.java,v $
003: * Date : $Date: 2008-02-27 12:05:36 $
004: * Version: $Revision: 1.4 $
005: *
006: * This library is part of OpenCms -
007: * the Open Source Content Management System
008: *
009: * Copyright (c) 2002 - 2008 Alkacon Software GmbH (http://www.alkacon.com)
010: *
011: * This library is free software; you can redistribute it and/or
012: * modify it under the terms of the GNU Lesser General Public
013: * License as published by the Free Software Foundation; either
014: * version 2.1 of the License, or (at your option) any later version.
015: *
016: * This library is distributed in the hope that it will be useful,
017: * but WITHOUT ANY WARRANTY; without even the implied warranty of
018: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019: * Lesser General Public License for more details.
020: *
021: * For further information about Alkacon Software GmbH, please see the
022: * company website: http://www.alkacon.com
023: *
024: * For further information about OpenCms, please see the
025: * project website: http://www.opencms.org
026: *
027: * You should have received a copy of the GNU Lesser General Public
028: * License along with this library; if not, write to the Free Software
029: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
030: */
031:
032: package org.opencms.util;
033:
034: import java.io.Serializable;
035:
036: /**
037: * Base class for all integer mode enumeration classes.<p>
038: *
039: * Like:<br>
040: * <ul>
041: * <li>{@link org.opencms.file.CmsResource.CmsResourceCopyMode}
042: * <li>{@link org.opencms.file.CmsResource.CmsResourceDeleteMode}
043: * <li>{@link org.opencms.file.CmsResource.CmsResourceUndoMode}
044: * </ul>
045: *
046: * @author Michael Moossen
047: *
048: * @version $Revision: 1.4 $
049: *
050: * @since 6.5.3
051: */
052: public abstract class A_CmsModeIntEnumeration implements Serializable {
053:
054: /** The internal mode descriptor. */
055: private final int m_mode;
056:
057: /**
058: * Default constructor.<p>
059: *
060: * @param mode the internal mode descriptor
061: */
062: protected A_CmsModeIntEnumeration(int mode) {
063:
064: m_mode = mode;
065: }
066:
067: /**
068: * @see java.lang.Object#equals(java.lang.Object)
069: */
070: public boolean equals(Object obj) {
071:
072: if (obj == this ) {
073: return true;
074: }
075: if (obj instanceof A_CmsModeIntEnumeration) {
076: if (obj.getClass().equals(this .getClass())) {
077: A_CmsModeIntEnumeration eObj = (A_CmsModeIntEnumeration) obj;
078: return eObj.getMode() == m_mode;
079: }
080: }
081: return false;
082: }
083:
084: /**
085: * Returns the mode.<p>
086: *
087: * @return the mode
088: */
089: public int getMode() {
090:
091: return m_mode;
092: }
093:
094: /**
095: * @see java.lang.Object#hashCode()
096: */
097: public int hashCode() {
098:
099: return m_mode;
100: }
101:
102: /**
103: * @see java.lang.Object#toString()
104: */
105: public String toString() {
106:
107: return String.valueOf(m_mode);
108: }
109: }
|