/*
 * Copyright 2014 Benjamin Linskey
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.benlinskey.greekreference;

/**
* An enum type to track the various app modes accessible from the navigation 
* drawer.
*/
public enum Mode {
    LEXICON_BROWSE(1, "lexicon_browse"),
    LEXICON_FAVORITES(2, "lexicon_favorites"),
    LEXICON_HISTORY(3, "lexicon_history"),
    SYNTAX_BROWSE(5, "syntax_browse"),
    SYNTAX_BOOKMARKS(6, "syntax_bookmarks");

    private final int mPosition;
    private final String mName;

    /**
     * Enum constructor.
     * @param position the navigation drawer position corresponding to this
     *                 mode
     * @param name     the name of this mode
     */
    Mode(int position, String name) {
        mPosition = position;
        mName = name;
    }

    @Override
    public String toString() {
        return mName;
    }

    /**
     * Returns the name of this mode.
     * <p>
     * This is just a duplicate of toString() for now, but it's included here in case we ever
     * want to make toString() return something other than mName.
     */
    public String getName() {
        return mName;
    }

    public int getPosition() {
        return mPosition;
    }

    /**
     * Returns the <code>Mode</code> corresponding to the specified navigation
     * drawer position.
     * @param  position the navigation drawer position for which to search
     * @return the <code>Mode</code> corresponding to the specified position
     */
    public static Mode getModeFromPosition(int position) {
        for (Mode m : Mode.values()) {
            if (m.mPosition == position) {
                return m;
            }
        }
        throw new IllegalArgumentException("Invalid nav drawer position");
    }

    /**
     * Returns the <code>Mode</code> corresponding to the specified name.
     * @param  name the name for which to search
     * @return the <code>Mode</code> corresponding to the specified name
     */
    public static Mode getModeFromName(String name) {
        for (Mode m : Mode.values()) {
            if (m.mName.equals(name)) {
                return m;
            }
        }
        throw new IllegalArgumentException("Invalid name");
    }

    /**
     * Returns <code>true</code> if the specified <code>Mode</code> is a 
     * lexicon mode.
     * @param  mode the <code>Mode</code> to check
     * @return <code>true</code> if the specified <code>Mode</code> is a
     *         lexicon mode, or <code>false</code> otherwise
     */
    public static boolean isLexiconMode(Mode mode) {
        return mode.equals(LEXICON_BROWSE) || mode.equals(LEXICON_FAVORITES)
                || mode.equals(LEXICON_HISTORY);
    }

    /**
     * Returns <code>true</code> if the specified <code>Mode</code> is a 
     * syntax mode.
     * @param  mode the <code>Mode</code> to check
     * @return <code>true</code> if the specified <code>Mode</code> is a
     *         syntax mode, or <code>false</code> otherwise
     */
    public static boolean isSyntaxMode(Mode mode) {
        return mode.equals(SYNTAX_BROWSE) || mode.equals(SYNTAX_BOOKMARKS);
    }
}

@@ -2844,24 +2844,149 @@
 xicon mode.%0A
+     * %3Cp%3E%0A     * This method is deprecated. The non-static method %3Ccode%3EisLexiconMode%3C/code%3E should be used%0A     * instead.%0A
      * @para
@@ -3016,32 +3016,32 @@
 /code%3E to check%0A
-
      * @return %3C
@@ -3158,32 +3158,48 @@
 herwise%0A     */%0A
+    @Deprecated%0A
     public stati
@@ -3312,16 +3312,16 @@
 ORITES)%0A
-
         
@@ -3360,32 +3360,370 @@
 ISTORY);%0A    %7D%0A%0A
+    /**%0A     * Returns %3Ccode%3Etrue%3C/code%3E if this is a lexicon mode.%0A     * @return %3Ccode%3Etrue%3C/code%3E if this is a lexicon mode, or %3Ccode%3Efalse%3C/code%3E otherwise%0A     */%0A    public boolean isLexiconMode() %7B%0A        return this.equals(LEXICON_BROWSE) %7C%7C this.equals(LEXICON_FAVORITES)%0A                %7C%7C this.equals(LEXICON_HISTORY);%0A    %7D%0A%0A
     /**%0A     * R

Add non-static mode checking methods.