Removed clientfile watcher elements in attempt to remove any locks after client is...
[vamsas.git] / src / uk / ac / vamsas / client / Vobjhash.java
1 package uk.ac.vamsas.client;\r
2 \r
3 /**\r
4  * Holds information about Vobj instances that is held over between different writes to the document.\r
5  * Currently records the LhashValue obtained from Vobject\r
6  * @author JimP\r
7  *\r
8  */\r
9 public class Vobjhash {\r
10   private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Vobjhash.class); \r
11   long  hashvalue;\r
12   /**\r
13    * creates a record of the hash value for a vamsas document object\r
14    * @param tobemarshalled\r
15    */\r
16   public Vobjhash(Vobject tobemarshalled) {\r
17     tobemarshalled.doHash();\r
18     hashvalue = tobemarshalled.get__last_hash();\r
19     if (log.isDebugEnabled())\r
20       log.debug(tobemarshalled.getVorbaId()+":"+hashvalue);\r
21   }\r
22   /**\r
23    * compares the old hash value with the unmarshalled object's most recently computed hash value and updates internal record.\r
24    * @param unmarshalled\r
25    * @return true if the hash values differ\r
26    */\r
27   public boolean isUpdated(Vobject unmarshalled) {\r
28     long oldhash = hashvalue;\r
29     unmarshalled.doHash();\r
30     hashvalue=unmarshalled.get__last_hash();\r
31     if (log.isDebugEnabled() && oldhash!=hashvalue)\r
32       log.debug(" has changed."+unmarshalled.getVorbaId());\r
33     return oldhash!=hashvalue;\r
34   }\r
35 }\r