/** * Returns the single object of a "keyed slot". * * @param slotOwner the object owning the slot * @param name name of key slot * @return object or <code>null</code> it does not exist */ public static RPObject getKeyedSlotObject(final SlotOwner slotOwner, final String name) { if (!slotOwner.hasSlot(name)) { logger.error("Expected to find " + name + " slot in " + slotOwner, new Throwable()); return null; } final RPSlot slot = slotOwner.getSlot(name); if (slot.size() == 0) { logger.error("Found empty " + name + " slot" + slotOwner, new Throwable()); return null; } return slot.iterator().next(); }
/** * Checks if the corpse is empty or not * * @return true if the corpse is empty */ public boolean isEmpty() { // size() is a method from RPSlot which counts the number of objects in the slot return content.size() == 0; }