package net.sourceforge.pain.tinylib.data.type;
import net.sourceforge.pain.data.*;
import net.sourceforge.pain.db.*;
import net.sourceforge.pain.tinylib.*;
import java.util.*;
/**
* Some Logical group of spaces.
* One space can present in many space groups
* Example of space group: Area, All Magic Places, All Market Places, All birth places.. and so on
*/
public final class SpaceGroup extends Role {
private static final int SPACES = 1 + LAST_BASE_FIELD_INDEX;
private static final int NAME = 2 + LAST_BASE_FIELD_INDEX;
private static final int NFIELDS = 3 + LAST_BASE_FIELD_INDEX;
public SpaceGroup() {
}
public SpaceGroup(PainDB db) {
super(db);
Mudlib.getWorld().getSpaceGroups().add(this);
}
public DbClassSchema provideSchema() {
byte types[] = new byte[NFIELDS];
String names[] = new String[NFIELDS];
fillSuperSchema(types, names);
types[SPACES] = DbType.REFERENCE_SET;
names[SPACES] = "spaces";
types[NAME] = DbType.STRING;
names[NAME] = "name";
return new DbClassSchema(types, names);
}
public Set getSpaces() {
return getRefSet(SPACES);
}
public void addSpace(Space space) {
getSpaces().add(space);
}
public void addRoom(Room room) {
getSpaces().add(room.asSpace());
}
public String getName() {
return getString(NAME);
}
public void setName(String newName) {
setString(NAME, newName);
}
}