package net.sourceforge.pain.data.type;
import net.sourceforge.pain.data.*;
import net.sourceforge.pain.db.*;
/**
this types defines all information that enough to interpret the object as physical matter
if object is easier it's weight = 0
*/
public final class Physical extends Role {
/**Size of the object, 3 dimentional attribute*/
public static final int SIZE = 1 + LAST_BASE_FIELD_INDEX;
/**Weight of the object*/
public static final int WEIGHT = 2 + LAST_BASE_FIELD_INDEX;
/**We can look on any physical object*/
public static final int APPEARANCE_DESC = 3 + LAST_BASE_FIELD_INDEX;
public static final int NFIELDS = 4 + LAST_BASE_FIELD_INDEX;
public final static Class superroles[] = new Class[]{Interactive.class}; // will have delegate methods
public Physical(PainDB db) {
super(db);
}
public Physical() {
}
public Class[] getSuperroles() {
return superroles;
}
public DbClassSchema provideSchema() {
byte types[] = new byte[NFIELDS];
String names[] = new String[NFIELDS];
fillSuperSchema(types, names);
types[SIZE] = DbType.INT;
names[SIZE] = "size";
types[WEIGHT] = DbType.INT;
names[WEIGHT] = "weight";
types[APPEARANCE_DESC] = DbType.STRING;
names[APPEARANCE_DESC] = "appearance_desc";
return new DbClassSchema(types, names);
}
public void setSize(int value) {
setInt(SIZE, value);
}
public void setWeight(int value) {
setInt(WEIGHT, value);
}
public void setAppearanceDesc(String value) {
setString(APPEARANCE_DESC, value);
}
public int getSize() {
return getInt(SIZE);
}
public int getWeight() {
return getInt(WEIGHT);
}
public String getAppearanceDesc() {
return getString(APPEARANCE_DESC);
}
public Interactive asInteractive() {
return (Interactive) getRole(Interactive.class);
}
public Located asLocated() {
return (Located) getRole(Located.class);
}
}