package net.sourceforge.pain.data.prototype; import net.sourceforge.pain.data.type.*; import net.sourceforge.pain.db.*; public final class ReceptivePrototype extends Prototype { public static final int HEAR = 1 + LAST_BASE_FIELD_INDEX; public static final int SEE = 2 + LAST_BASE_FIELD_INDEX; public static final int FEEL = 3 + LAST_BASE_FIELD_INDEX; //touches... public static final int NFIELDS = 4 + LAST_BASE_FIELD_INDEX; public final static Class superroles[] = new Class[]{LocatedPrototype.class}; public ReceptivePrototype(PainDB db) { super(db); setCanHear(true); setCanSee(true); setCanFeel(true); } public ReceptivePrototype() { } public DbClassSchema provideSchema() { byte types[] = new byte[NFIELDS]; String names[] = new String[NFIELDS]; fillSuperSchema(types, names); types[HEAR] = DbType.BOOLEAN; names[HEAR] = "can_hear"; types[SEE] = DbType.BOOLEAN; names[SEE] = "can_see"; types[FEEL] = DbType.BOOLEAN; names[FEEL] = "can_feel"; return new DbClassSchema(types, names); } public Class[] getSuperroles() { return superroles; } public boolean canHear() { return getBoolean(HEAR); } public void setCanHear(boolean canHear) { setBoolean(HEAR, canHear); } public boolean canSee() { return getBoolean(SEE); } public void setCanSee(boolean canSee) { setBoolean(SEE, canSee); } public boolean canFeel() { return getBoolean(FEEL); } public void setCanFeel(boolean canFeel) { setBoolean(FEEL, canFeel); } public boolean has(int receptionType) { switch (receptionType) { case FEEL: return canFeel(); case SEE: return canSee(); case HEAR: return canHear(); default: throw new RuntimeException("Unknown reception receptionType!:" + receptionType); } } public Class getPrototypedRoleClass() { return Receptive.class; } public String toString() { return "can_hear="+canHear()+" can_feel="+canFeel()+" can_see="+canSee(); } }