package database; import java.util.Collection; import java.util.List; /** * This class is a superclass for most other classes inside the database package. * It mainly contains methods for updating the field, as well as syncing its new * updated information to the back-end database. Note that a dataItem can contain * many custom fields, which are key value pairs. * @author jroll * */ public abstract class DataItem { public List customFields; /** * Update a custom field in the collection of customFields to that of a new value. */ /*@ requires //customFields must be initialized, and must have a current entry for the data field this.customFields != null; ensures // // The custom field now has an updated value // customFields.get(0).equals(value); @*/ public void update(String key, String value) {}; /** * Insert the custom field into the custom field collection. */ /*@ // // none // ensures // // A custom field is in the custom field list if and only if it is the new // record to be added or it is in the input list. // (\forall CustomDataField cf_other ; customFields.contains(cf_other) <==> cf_other.equals(dataField) || (customFields).contains(cf_other)); @*/ public abstract void insertCustomField(CustomDataField dataField); }