-/**
- * Returns the Persistent ID of this object. The PID is set when saving this object. It is unique in the scope of the class
- * of this object only.
- *
- * @return the PID of this, or 0 if this is not saved.
- * @see isSaved()
- */
- public long getIndex () {
-// ----------------------
- return rid;
- }
+ /**
+ * Checks the mutual compatibility of arguments previously set in the given properties object, if the validity check is enabled. As this
+ * validity depends on concrete classes, the check is delegated to subclasses of the given Persistent.Properties.
+ */
+ protected Persistent(ObjectProperties oprop)
+ throws MissedPropertyException, InvalidPropertyException,
+ MultiplyDefinedException {
+ // ---------------------------------------------
+ if (oprop.mustBeChecked())
+ oprop.checkValidity(); // Throws one of the above exception if not valid
+ rid = 0; // Set when saving the object
+ }
+
+ // ==============================================================================================================================
+ // Public member functions
+ // ==============================================================================================================================
+
+ public boolean equals(Object entity) {
+ // ------------------------------------
+ if (entity == null)
+ return false;
+ if (entity.getClass().equals(this.getClass())) {
+ Persistent object = (Persistent) entity;
+ long he = object.getIndex(); // getIndex() is supposed fetching the index if not yet done
+ long me = this.getIndex(); // getIndex() is supposed fetching the index if not yet done
+ if (me * he != 0)
+ return (he == me);
+ if (me + he == 0)
+ return (this == object);
+ }
+ return false;
+ }
+
+ /**
+ * Returns the Persistent ID of this object. The PID is set when saving this object. It is unique in the scope of the class of this
+ * object only.
+ *
+ * @return the PID of this, or 0 if this is not saved.
+ * @see isSaved()
+ */
+ public long getIndex() {
+ // ----------------------
+ return rid;
+ }