EquippedPrototype.java

src/net/sourceforge/pain/data/prototype/EquippedPrototype.java · 1.4 KB

From the archive pain_0_42.zip

Download the archive   « Back to the archive contents

package net.sourceforge.pain.data.prototype;

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

/**
 * User: fmike  Date: Oct 12, 2003   Time: 1:08:05 AM
 */
public final class EquippedPrototype extends Prototype {

	public static final int INVENTORY_PROTO = 1 + LAST_BASE_FIELD_INDEX;;
	public static final int NFIELDS = 2 + LAST_BASE_FIELD_INDEX;;

	public final static Class[] superroles = new Class[]{InteractivePrototype.class};

	public EquippedPrototype() {
	}

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

	protected Class[] getSuperroles() {
		return superroles;
	}

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

		types[INVENTORY_PROTO] = DbType.REFERENCE;
		names[INVENTORY_PROTO] = "inventory";

		return new DbClassSchema(types, names);
	}

	public Class getPrototypedRoleClass() {
		return Equipped.class;
	}

	public SpacePrototype getInventoryPrototype() {
		return (SpacePrototype) getReference(INVENTORY_PROTO);
	}

	public void setInventoryPrototype(SpacePrototype p) {
		setReference(INVENTORY_PROTO, p);
	}

	public void delete() {
		getInventoryPrototype().delete();
		super.delete();
	}

	public String toString() {
		SpacePrototype sp = getInventoryPrototype();
		return "inv name=" + (sp == null ? null : sp.getSpaceName()) + " desc=" + (sp == null ? null : sp.getSpaceDesc());
	}
}

Site Stats

Snippets: 1791
Codebases: 571