/*
* Copyright (C) 2012 Joe AmRhein
*
* 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.arconus.dicecommander.model.entities.character.power;
import com.arconus.dicecommander.R;
import com.arconus.dicecommander.utilities.IResourceAndDBPair;
public enum PowerUsage implements IResourceAndDBPair {
AT_WILL(0, R.string.power_usage_at_will),
ENCOUNTER(1, R.string.power_usage_encounter),
DAILY(2, R.string.power_usage_daily);
private int dbID;
private int resID;
private static final PowerUsage[] values = values();
private PowerUsage(int dbID, int resID) {
this.dbID = dbID;
this.resID = resID;
}
//used by content provider to store enum value in database
public int getDatabaseID() {
return dbID;
}
//used to reference the string resource associated with this enum. Allows for
//localization of strings
public int getResourceID() {
return resID;
}
public static PowerUsage parseInt(int index) {
if (index >= values.length || index < 0) {
return null;
}
return values[index];
}
}