KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > fractal > julia > conform > components > C


1 /***
2  * Julia: France Telecom's implementation of the Fractal API
3  * Copyright (C) 2001-2002 France Telecom R&D
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: Eric.Bruneton@rd.francetelecom.com
20  *
21  * Author: Eric Bruneton
22  */

23
24 package org.objectweb.fractal.julia.conform.components;
25
26 import org.objectweb.fractal.api.control.BindingController;
27
28 import java.util.Map JavaDoc;
29 import java.util.HashMap JavaDoc;
30
31 public class C implements CAttributes, BindingController, I, J {
32
33   private boolean x1;
34   private byte x2;
35   private char x3;
36   private short x4;
37   private int x5;
38   private long x6;
39   private float x7;
40   private double x8;
41   private String JavaDoc x9;
42   private boolean x11;
43
44   private I i;
45
46   private Map JavaDoc j = new HashMap JavaDoc();
47
48   // ATTRIBUTE CONTROLLER
49

50   public boolean getX1 () {
51     return x1;
52   }
53
54   public void setX1 (boolean x1) {
55     this.x1 = x1;
56   }
57
58   public byte getX2 () {
59     return x2;
60   }
61
62   public void setX2 (byte x2) {
63     this.x2 = x2;
64   }
65
66   public char getX3 () {
67     return x3;
68   }
69
70   public void setX3 (char x3) {
71     this.x3 = x3;
72   }
73
74   public short getX4 () {
75     return x4;
76   }
77
78   public void setX4 (short x4) {
79     this.x4 = x4;
80   }
81
82   public int getX5 () {
83     return x5;
84   }
85
86   public void setX5 (int x5) {
87     this.x5 = x5;
88   }
89
90   public long getX6 () {
91     return x6;
92   }
93
94   public void setX6 (long x6) {
95     this.x6 = x6;
96   }
97
98   public float getX7 () {
99     return x7;
100   }
101
102   public void setX7 (float x7) {
103     this.x7 = x7;
104   }
105
106   public double getX8 () {
107     return x8;
108   }
109
110   public void setX8 (double x8) {
111     this.x8 = x8;
112   }
113
114   public String JavaDoc getX9 () {
115     return x9;
116   }
117
118   public void setX9 (String JavaDoc x9) {
119     this.x9 = x9;
120   }
121
122   public boolean getReadOnlyX10 () {
123     return true;
124   }
125
126   public void setWriteOnlyX11 (boolean x11) {
127     this.x11 = x11;
128   }
129
130   // BINDING CONTROLLER
131

132   public String JavaDoc[] listFc () {
133     String JavaDoc[] result = new String JavaDoc[j.size() + 1];
134     j.keySet().toArray(result);
135     result[j.size()] = "client";
136     return result;
137   }
138
139   public Object JavaDoc lookupFc (String JavaDoc s) {
140     if (s.equals("client")) {
141       return i;
142     } else if (s.startsWith("clients")) {
143       return j.get(s);
144     }
145     return null;
146   }
147
148   public void bindFc (String JavaDoc s, Object JavaDoc o) {
149     if (s.equals("client")) {
150       i = (I)o;
151     } else if (s.startsWith("clients")) {
152       j.put(s, o);
153     }
154   }
155
156   public void unbindFc (String JavaDoc s) {
157     if (s.equals("client")) {
158       i = null;
159     } else if (s.startsWith("clients")) {
160       j.remove(s);
161     }
162   }
163
164   // FUNCTIONAL INTERFACE
165

166   public void m (boolean v) {
167   }
168
169   public void m (byte v) {
170   }
171
172   public void m (char v) {
173   }
174
175   public void m (short v) {
176   }
177
178   public void m (int v) {
179   }
180
181   public void m (long v) {
182   }
183
184   public void m (float v) {
185   }
186
187   public void m (double v) {
188   }
189
190   public void m (String JavaDoc v) {
191   }
192
193   public void m (String JavaDoc[] v) {
194   }
195
196   public boolean n (boolean v, String JavaDoc[] w) {
197     return v | x11; // for write only attribute tests
198
}
199
200   public byte n (byte v, String JavaDoc w) {
201     return v;
202   }
203
204   public char n (char v, double w) {
205     return v;
206   }
207
208   public short n (short v, float w) {
209     return v;
210   }
211
212   public int n (int v, long w) {
213     if (i != null) {
214       // for interceptors tests
215
return w == 0 ? v : i.n(v + 1, w - 1);
216     } else if (j.size() > 0) {
217       // for interceptors tests
218
return w == 0 ? v : ((I)j.values().iterator().next()).n(v + 1, w - 1);
219     } else {
220       return v;
221     }
222   }
223
224   public long n (long v, int w) {
225     return v;
226   }
227
228   public float n (float v, short w) {
229     return v;
230   }
231
232   public double n (double v, char w) {
233     return v;
234   }
235
236   public String JavaDoc n (String JavaDoc v, byte w) {
237     return v;
238   }
239
240   public String JavaDoc[] n (String JavaDoc[] v, boolean w) {
241     return v;
242   }
243 }
244
Popular Tags