KickJava   Java API By Example, From Geeks To Geeks.

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


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 UTOBcastChunk}interface.
34  */

35 public class UTOBcastChunkImpl extends AbstractChunk implements UTOBcastChunk
36 {
37   /** The type of the message that contains this chunk. */
38   protected byte utoBcastMessageType = -1;
39
40   /** The process that sent this chunk. */
41   protected Process JavaDoc processFrom;
42
43   /** The process to which this chunk is destinated. */
44   protected Process JavaDoc processTo;
45
46   /** The sequence number of this message. */
47   protected long sn = -1;
48
49   // ---------------------------------------------------------------------------
50
// Implementation of the UTOBcastChunk interface
51
// ---------------------------------------------------------------------------
52
/**
53    * @see UTOBcastChunk#getUTOBcastMessageType()
54    */

55   public byte getUTOBcastMessageType()
56   {
57     return utoBcastMessageType;
58   }
59
60   /**
61    * @see UTOBcastChunk#setUTOBcastMessageType(byte)
62    */

63   public void setUTOBcastMessageType(byte type)
64   {
65     this.utoBcastMessageType = type;
66   }
67
68   /**
69    * @see UTOBcastChunk#getProcessFrom()
70    */

71   public Process JavaDoc getProcessFrom()
72   {
73     return processFrom;
74   }
75
76   /**
77    * @see UTOBcastChunk#setProcessFrom(Process)
78    */

79   public void setProcessFrom(Process JavaDoc process)
80   {
81     this.processFrom = process;
82   }
83
84   /**
85    * @see UTOBcastChunk#getProcessTo()
86    */

87   public Process JavaDoc getProcessTo()
88   {
89     return processTo;
90   }
91
92   /**
93    * @see UTOBcastChunk#setProcessTo(Process)
94    */

95   public void setProcessTo(Process JavaDoc process)
96   {
97     this.processTo = process;
98   }
99
100   /**
101    * @see UTOBcastChunk#setSequenceNumber(long)
102    */

103   public void setSequenceNumber(long sn)
104   {
105     this.sn = sn;
106   }
107
108   /**
109    * @see UTOBcastChunk#getSequenceNumber()
110    */

111   public long getSequenceNumber()
112   {
113     return sn;
114   }
115
116   // ---------------------------------------------------------------------------
117
// Implementation of the Chunk interface
118
// ---------------------------------------------------------------------------
119

120   /**
121    * @see Chunk#getType()
122    */

123   public ChunkType getType()
124   {
125     return TYPE;
126   }
127
128   /**
129    * @see Chunk#transfertState(Chunk)
130    */

131   public void transfertState(Chunk newInstance)
132   {
133     ((UTOBcastChunk) newInstance)
134         .setUTOBcastMessageType(getUTOBcastMessageType());
135     ((UTOBcastChunk) newInstance).setSequenceNumber(getSequenceNumber());
136     ((UTOBcastChunk) newInstance).setProcessFrom(getProcessFrom());
137     ((UTOBcastChunk) newInstance).setProcessTo(getProcessTo());
138   }
139
140   /**
141    * @see Chunk#recycle()
142    */

143   public void recycle()
144   {
145     utoBcastMessageType = -1;
146     processFrom = null;
147     processTo = null;
148     sn = -1;
149   }
150
151 }
Popular Tags