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 { 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 and updates internal record. * @param unmarshalled * @return true if the hash values differ */ public boolean isUpdated(Vobject unmarshalled) { long oldhash = hashvalue; unmarshalled.doHash(); hashvalue=unmarshalled.get__last_hash(); if (log.isDebugEnabled() && oldhash!=hashvalue) log.debug(" has changed."+unmarshalled.getVorbaId()); return oldhash!=hashvalue; } }