Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

DefaultSynchroAtomicObject.java

00001 /*
00002  * OpenMobileIS - a free Java(TM) Framework for mobile applications Java(TM)
00003  * Copyright (C) 2004-2005 Philippe Delrieu
00004  * All rights reserved.
00005  * Contact: openmobileis@e-care.fr
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00020  * USA
00021  *
00022  *  Author : Philippe Delrieu
00023  *  
00024  *  Modifications :
00025  *  2004 Creation P.Delrieu
00026  * 
00027  */
00028 
00029 package org.openmobileis.synchro.algo.replication;
00030 
00038 public class DefaultSynchroAtomicObject implements SynchroAtomicObject {
00039   static final long serialVersionUID = 5521257935120563452L;
00040 
00041   private String uid;
00042   private String checksum;
00043   private long syncnumber;
00044   private short modificationType;
00045   private long creationDate;
00046 
00047   public DefaultSynchroAtomicObject(String id, String sum, long syncnumber, short type, long creationdate) {
00048     uid = id;
00049     checksum=sum;
00050     this.syncnumber=syncnumber;
00051     modificationType = type;
00052     creationDate = creationdate;
00053   }
00054   public DefaultSynchroAtomicObject(String id, String sum) {
00055     uid = id;
00056     checksum=sum;
00057     syncnumber=0;
00058     creationDate = 0;
00059     modificationType = SynchroAtomicObject.ADD;
00060   }
00061 
00062   public long getCreationDate() {
00063     return creationDate;
00064   }
00065 
00066   public String getUID() {
00067     return uid;
00068   }
00069 
00070   public String getCheckSum() {
00071     return checksum;
00072   }
00073   public void setCheckSum(String sum) {
00074     checksum = sum;
00075   }
00076 
00077   public long getModifSyncNumber() {
00078     return syncnumber;
00079   }
00080   public void setModifSyncNumber(long ts)  {
00081     syncnumber = ts;
00082   }
00083 
00084   public short getModificationType() {
00085     return modificationType;
00086   }
00087 
00088   public void setModificationType(short type) {
00089     modificationType = type;
00090   }
00091 
00092   public boolean equals(Object obj) {
00093     if (obj instanceof SynchroAtomicObject) {
00094       if(((SynchroAtomicObject)obj).getUID().equals(uid)) {
00095         return true;
00096       }
00097     }
00098     return false;
00099   }
00100 
00101   public int hashCode() {
00102     return uid.hashCode();
00103   }
00104 }

Generated on Wed Dec 14 21:05:32 2005 for OpenMobileIS by  doxygen 1.4.4