KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > dream > protocol > utobcast > message > UPDChunkImpl


1 /**
2  * Dream
3  * Copyright (C) 2003-2004 INRIA Rhone-Alpes
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Contact: dream@objectweb.org
20  *
21  * Initial developer(s): Vivien Quema
22  * Contributor(s):
23  */

24
25 package org.objectweb.dream.protocol.utobcast.message;
26
27 import org.objectweb.dream.message.AbstractChunk;
28 import org.objectweb.dream.message.Chunk;
29 import org.objectweb.dream.message.ChunkType;
30 import org.objectweb.dream.protocol.Process;
31
32 /**
33  * Basic implementation of the {@link UPDChunk}interface.
34  */

35 public class UPDChunkImpl extends AbstractChunk implements UPDChunk
36 {
37   /** The process array. */
38   protected Process JavaDoc[] processes;
39
40   /** The sequence number of this message. */
41   protected long sn = -1;
42
43   // ---------------------------------------------------------------------------
44
// Implementation of the UPDChunk interface
45
// ---------------------------------------------------------------------------
46
/**
47    * @see org.objectweb.dream.protocol.utobcast.message.UPDChunk#setSequenceNumber(long)
48    */

49   public void setSequenceNumber(long sn)
50   {
51     this.sn = sn;
52   }
53
54   /**
55    * @see org.objectweb.dream.protocol.utobcast.message.UPDChunk#getSequenceNumber()
56    */

57   public long getSequenceNumber()
58   {
59     return sn;
60   }
61
62   /**
63    * @see org.objectweb.dream.protocol.utobcast.message.UPDChunk#getProcesses()
64    */

65   public Process JavaDoc[] getProcesses()
66   {
67     return processes;
68   }
69
70   /**
71    * @see org.objectweb.dream.protocol.utobcast.message.UPDChunk#setProcesses(org.objectweb.dream.protocol.Process[])
72    */

73   public void setProcesses(Process JavaDoc[] processes)
74   {
75     this.processes = processes;
76   }
77
78   // ---------------------------------------------------------------------------
79
// Implementation of the Chunk interface
80
// ---------------------------------------------------------------------------
81

82   /**
83    * @see Chunk#getType()
84    */

85   public ChunkType getType()
86   {
87     return TYPE;
88   }
89
90   /**
91    * @see Chunk#transfertState(Chunk)
92    */

93   public void transfertState(Chunk newInstance)
94   {
95     ((UPDChunk) newInstance).setProcesses(getProcesses());
96     ((UPDChunk) newInstance).setSequenceNumber(getSequenceNumber());
97   }
98
99   /**
100    * @see Chunk#recycle()
101    */

102   public void recycle()
103   {
104     processes = null;
105     sn = -1;
106   }
107
108 }
Popular Tags