/
area/
classes/net/sourceforge/pain/logic/
classes/net/sourceforge/pain/logic/event/
classes/net/sourceforge/pain/logic/fn/util/
classes/net/sourceforge/pain/network/console/
classes/net/sourceforge/pain/plugin/
classes/net/sourceforge/pain/plugin/reset/
classes/net/sourceforge/pain/plugin/shutdown/
classes/net/sourceforge/pain/plugin/social/
classest/net/sourceforge/pain/db/data/
doc/
doc/paindb/resources/
src/net/sourceforge/pain/logic/
src/net/sourceforge/pain/logic/event/
src/net/sourceforge/pain/logic/fn/util/
src/net/sourceforge/pain/network/console/
src/net/sourceforge/pain/network/console/telnet/
src/net/sourceforge/pain/plugin/
src/net/sourceforge/pain/plugin/command/
src/net/sourceforge/pain/plugin/reset/
src/net/sourceforge/pain/plugin/shutdown/
src/net/sourceforge/pain/plugin/social/
src/net/sourceforge/pain/util/
tests/
tests/net/sourceforge/pain/db/data/
package net.sourceforge.pain.data.type;


import net.sourceforge.pain.data.*;
import net.sourceforge.pain.db.*;

import java.util.*;


/**
 * Reset group is a group with a common time for all resets
 */
public final class ResetGroup extends Role {

	public static final int NEXT_RESET_TIME = 1 + LAST_BASE_FIELD_INDEX;
	public static final int RESET_PERIOD = 2 + LAST_BASE_FIELD_INDEX;
	public static final int RESET_MESSAGE = 3 + LAST_BASE_FIELD_INDEX;
	public static final int RESETS = 4 + LAST_BASE_FIELD_INDEX;
	public static final int GROUP_ID = 5 + LAST_BASE_FIELD_INDEX;
	public static final int GROUP_INFO = 6 + LAST_BASE_FIELD_INDEX;
	public static final int NFIELDS = 7 + LAST_BASE_FIELD_INDEX;

	public ResetGroup() {
	}

	public ResetGroup(PainDB db) {
		super(db);
	}


	public DbClassSchema provideSchema() {
		byte types[] = new byte[NFIELDS];
		String names[] = new String[NFIELDS];
		fillSuperSchema(types, names);

		types[NEXT_RESET_TIME] = DbType.INT;
		names[NEXT_RESET_TIME] = "next_reset_time";

		types[RESET_PERIOD] = DbType.INT;
		names[RESET_PERIOD] = "reset_period";

		types[RESET_MESSAGE] = DbType.STRING;
		names[RESET_MESSAGE] = "reset_message";

		types[RESETS] = DbType.REFERENCE_SET;
		names[RESETS] = "resets";

		types[GROUP_ID] = DbType.STRING;
		names[GROUP_ID] = "group_id";

		types[GROUP_INFO] = DbType.STRING;
		names[GROUP_INFO] = "group_info";


		return new DbClassSchema(types, names);
	}

	public int getResetPeriod() {
		return getInt(RESET_PERIOD);
	}

	public void setResetPeriod(int time) {
		setInt(RESET_PERIOD, time);
	}


	public int getNextResetTime() {
		return getInt(NEXT_RESET_TIME);
	}

	public void setNextResetTime(int time) {
		setInt(NEXT_RESET_TIME, time);
	}

	public String getResetMessage() {
		return getString(RESET_MESSAGE);
	}

	public void setResetMessage(String message) {
		setString(RESET_MESSAGE, message);
	}


	public Set getResets() {
		return Collections.unmodifiableSet(getRefSet(RESETS));
	}

	public void addReset(Reset reset) {
		getRefSet(RESETS).add(reset);
	}

	public void setGroupInfo(String info) {
		setString(GROUP_INFO, info);
	}

	public String getGroupInfo() {
		return getString(GROUP_INFO);
	}

	public void setGroupId(String id) {
		setString(GROUP_ID, id);
	}

	public String getGroupId() {
		return getString(GROUP_ID);
	}
}