2 * This file is part of the Vamsas Client version 0.1.
\r
3 * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
\r
4 * Andrew Waterhouse and Dominik Lindner.
\r
6 * Earlier versions have also been incorporated into Jalview version 2.4
\r
7 * since 2008, and TOPALi version 2 since 2007.
\r
9 * The Vamsas Client is free software: you can redistribute it and/or modify
\r
10 * it under the terms of the GNU Lesser General Public License as published by
\r
11 * the Free Software Foundation, either version 3 of the License, or
\r
12 * (at your option) any later version.
\r
14 * The Vamsas Client is distributed in the hope that it will be useful,
\r
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
17 * GNU Lesser General Public License for more details.
\r
19 * You should have received a copy of the GNU Lesser General Public License
\r
20 * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
\r
22 package uk.ac.vamsas.client;
\r
25 * Holds information about Vobj instances that is held over between different
\r
26 * writes to the document. Currently records the LhashValue obtained from
\r
32 public class Vobjhash {
\r
33 private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory
\r
34 .getLog(Vobjhash.class);
\r
39 * creates a record of the hash value for a vamsas document object
\r
41 * @param tobemarshalled
\r
43 public Vobjhash(Vobject tobemarshalled) {
\r
44 tobemarshalled.doHash();
\r
45 hashvalue = tobemarshalled.get__last_hash();
\r
46 if (log.isDebugEnabled())
\r
47 log.debug(tobemarshalled.getVorbaId() + ":" + hashvalue);
\r
51 * compares the old hash value with the unmarshalled object's most recently
\r
52 * computed hash value and updates internal record.
\r
54 * @param unmarshalled
\r
55 * @return true if the hash values differ
\r
57 public boolean isUpdated(Vobject unmarshalled) {
\r
58 long oldhash = hashvalue;
\r
59 unmarshalled.doHash();
\r
60 hashvalue = unmarshalled.get__last_hash();
\r
61 if (log.isDebugEnabled() && oldhash != hashvalue)
\r
62 log.debug(" has changed." + unmarshalled.getVorbaId());
\r
63 return oldhash != hashvalue;
\r