X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fuk%2Fac%2Fvamsas%2Fclient%2FVobjhash.java;h=1b258dc4abd9bcc729d24cd6849b26189523d64e;hb=20e7f086427f1fe0aac1e5cb8e24f6fda568d50d;hp=f2feab91b20ecd9fb44a3d2b5ac24c6bcc999f7e;hpb=ea8b10ee787a2b1e2b35f2acb4dccaf12fd2a6fd;p=vamsas.git diff --git a/src/uk/ac/vamsas/client/Vobjhash.java b/src/uk/ac/vamsas/client/Vobjhash.java index f2feab9..1b258dc 100644 --- a/src/uk/ac/vamsas/client/Vobjhash.java +++ b/src/uk/ac/vamsas/client/Vobjhash.java @@ -2,24 +2,34 @@ package uk.ac.vamsas.client; /** * Holds information about Vobj instances that is held over between different writes to the document. + * Currently records the LhashValue obtained from Vobject * @author JimP * */ public class Vobjhash { - int hashvalue; + private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Vobjhash.class); + long hashvalue; /** * creates a record of the hash value for a vamsas document object * @param tobemarshalled */ public Vobjhash(Vobject tobemarshalled) { + tobemarshalled.doHash(); hashvalue = tobemarshalled.get__last_hash(); + if (log.isDebugEnabled()) + log.debug(tobemarshalled.getVorbaId()+":"+hashvalue); } /** - * compares the old hash value with the unmarshalled object's most recently computed hash value. + * compares the old hash value with the unmarshalled object's most recently computed hash value and updates internal record. * @param unmarshalled * @return true if the hash values differ */ public boolean isUpdated(Vobject unmarshalled) { - return hashvalue==unmarshalled.get__last_hash(); + long oldhash = hashvalue; + unmarshalled.doHash(); + hashvalue=unmarshalled.get__last_hash(); + if (log.isDebugEnabled() && oldhash!=hashvalue) + log.debug(" has changed."+unmarshalled.getVorbaId()); + return oldhash!=hashvalue; } }