Source Code Cross Referenced for TestSetFactory.java in  » Ajax » GWT » com » google » gwt » user » client » rpc » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Ajax » GWT » com.google.gwt.user.client.rpc 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2007 Google Inc.
003:         * 
004:         * Licensed under the Apache License, Version 2.0 (the "License"); you may not
005:         * use this file except in compliance with the License. You may obtain a copy of
006:         * the License at
007:         * 
008:         * http://www.apache.org/licenses/LICENSE-2.0
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
012:         * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
013:         * License for the specific language governing permissions and limitations under
014:         * the License.
015:         */
016:        package com.google.gwt.user.client.rpc;
017:
018:        import java.util.ArrayList;
019:        import java.util.Date;
020:        import java.util.HashMap;
021:        import java.util.HashSet;
022:        import java.util.Vector;
023:
024:        /**
025:         * TODO: document me.
026:         */
027:        public class TestSetFactory {
028:
029:            /**
030:             * TODO: document me.
031:             */
032:            public static class SerializableClass implements  IsSerializable {
033:                public IsSerializable getElementRef() {
034:                    return elementRef;
035:                }
036:
037:                public IsSerializable[] getElements() {
038:                    return elements;
039:                }
040:
041:                public void setElementRef(IsSerializable elementRef) {
042:                    this .elementRef = elementRef;
043:                }
044:
045:                public void setElements(IsSerializable[] elements) {
046:                    this .elements = elements;
047:                }
048:
049:                IsSerializable elementRef;
050:
051:                IsSerializable[] elements;
052:            }
053:
054:            /**
055:             * TODO: document me.
056:             */
057:            public static class SerializableDoublyLinkedNode implements 
058:                    IsSerializable {
059:                public String getData() {
060:                    return data;
061:                }
062:
063:                public SerializableDoublyLinkedNode getLeftChild() {
064:                    return leftChild;
065:                }
066:
067:                public SerializableDoublyLinkedNode getRightChild() {
068:                    return rightChild;
069:                }
070:
071:                public void setData(String data) {
072:                    this .data = data;
073:                }
074:
075:                public void setLeftChild(SerializableDoublyLinkedNode leftChild) {
076:                    this .leftChild = leftChild;
077:                }
078:
079:                public void setRightChild(
080:                        SerializableDoublyLinkedNode rightChild) {
081:                    this .rightChild = rightChild;
082:                }
083:
084:                protected String data;
085:                protected SerializableDoublyLinkedNode leftChild;
086:                protected SerializableDoublyLinkedNode rightChild;
087:            }
088:
089:            /**
090:             * TODO: document me.
091:             */
092:            public static class SerializableList extends ArrayList implements 
093:                    IsSerializable {
094:            }
095:
096:            /**
097:             * TODO: document me.
098:             */
099:            public static class SerializableMap extends HashMap implements 
100:                    IsSerializable {
101:            }
102:
103:            /**
104:             * TODO: document me.
105:             */
106:            public static class SerializableNode extends UnserializableNode
107:                    implements  IsSerializable {
108:
109:                public boolean equals(Object obj) {
110:                    if (this  == obj) {
111:                        return true;
112:                    }
113:
114:                    if (obj == null) {
115:                        return false;
116:                    }
117:
118:                    if (!(obj instanceof  SerializableNode)) {
119:                        return false;
120:                    }
121:
122:                    SerializableNode other = (SerializableNode) obj;
123:                    if (data != other.data) {
124:                        if (data == null || !data.equals(other.data)) {
125:                            return false;
126:                        }
127:                    }
128:
129:                    if (next != other.next) {
130:                        if (next == null || !next.equals(other.next)) {
131:                            return false;
132:                        }
133:                    }
134:
135:                    return true;
136:                }
137:
138:                public String getData() {
139:                    return data;
140:                }
141:
142:                public SerializableNode getNext() {
143:                    return next;
144:                }
145:
146:                public int hashCode() {
147:                    int hashValue = 0;
148:                    if (data != null) {
149:                        hashValue += data.hashCode();
150:                    }
151:
152:                    if (next != null && next != this ) {
153:                        hashValue += next.hashCode();
154:                    }
155:
156:                    return hashValue;
157:                }
158:
159:                public void setData(String data) {
160:                    this .data = data;
161:                }
162:
163:                public void setNext(SerializableNode next) {
164:                    this .next = next;
165:                }
166:
167:                protected String data;
168:
169:                protected SerializableNode next;
170:            }
171:
172:            /**
173:             * TODO: document me.
174:             */
175:            public static class SerializableSet extends HashSet implements 
176:                    IsSerializable {
177:            }
178:
179:            /**
180:             * TODO: document me.
181:             */
182:            public static class SerializableVector extends Vector implements 
183:                    IsSerializable {
184:            }
185:
186:            /**
187:             * TODO: document me.
188:             */
189:            public static class UnserializableNode {
190:            }
191:
192:            public static Boolean[] createBooleanArray() {
193:                return new Boolean[] { Boolean.valueOf(true),
194:                        Boolean.valueOf(false), Boolean.valueOf(true),
195:                        Boolean.valueOf(false) };
196:            }
197:
198:            public static Byte[] createByteArray() {
199:                return new Byte[] { new Byte(Byte.MAX_VALUE),
200:                        new Byte(Byte.MIN_VALUE), new Byte(Byte.MAX_VALUE),
201:                        new Byte(Byte.MIN_VALUE) };
202:            }
203:
204:            public static Character[] createCharArray() {
205:                return new Character[] { new Character(Character.MAX_VALUE),
206:                        new Character(Character.MIN_VALUE),
207:                        new Character(Character.MAX_VALUE),
208:                        new Character(Character.MIN_VALUE) };
209:            }
210:
211:            public static Date[] createDateArray() {
212:                return new Date[] { new Date(1992 - 1900, 9, 18),
213:                        new Date(1997 - 1900, 6, 6) };
214:            }
215:
216:            public static Double[] createDoubleArray() {
217:                return new Double[] { new Double(Double.MAX_VALUE),
218:                        new Double(Double.MIN_VALUE),
219:                        new Double(Double.MAX_VALUE),
220:                        new Double(Double.MIN_VALUE) };
221:            }
222:
223:            public static Float[] createFloatArray() {
224:                return new Float[] { new Float(Float.MAX_VALUE),
225:                        new Float(Float.MIN_VALUE), new Float(Float.MAX_VALUE),
226:                        new Float(Float.MIN_VALUE) };
227:            }
228:
229:            public static HashMap createHashMap() {
230:                HashMap map = new HashMap();
231:                map.put("SerializableNode", new SerializableNode());
232:                map.put("SerializableList", new SerializableList());
233:                map.put("SerializableMap", new SerializableMap());
234:                map.put("SerializableSet", new SerializableSet());
235:                map.put("SerializableVector", new SerializableVector());
236:                return map;
237:            }
238:
239:            public static HashSet createHashSet() {
240:                HashSet set = new HashSet();
241:                set.add(new SerializableNode());
242:                set.add(new SerializableList());
243:                set.add(new SerializableMap());
244:                set.add(new SerializableSet());
245:                set.add(new SerializableVector());
246:
247:                return set;
248:            }
249:
250:            public static Integer[] createIntegerArray() {
251:                return new Integer[] { new Integer(Integer.MAX_VALUE),
252:                        new Integer(Integer.MIN_VALUE),
253:                        new Integer(Integer.MAX_VALUE),
254:                        new Integer(Integer.MIN_VALUE) };
255:            }
256:
257:            public static Long[] createLongArray() {
258:                return new Long[] { new Long(Long.MAX_VALUE),
259:                        new Long(Long.MIN_VALUE), new Long(Long.MAX_VALUE),
260:                        new Long(Long.MIN_VALUE) };
261:            }
262:
263:            public static boolean[] createPrimitiveBooleanArray() {
264:                return new boolean[] { true, true, false, false, true, false };
265:            }
266:
267:            public static byte[] createPrimitiveByteArray() {
268:                return new byte[] { Byte.MAX_VALUE, Byte.MIN_VALUE,
269:                        Byte.MAX_VALUE, Byte.MIN_VALUE };
270:            }
271:
272:            public static char[] createPrimitiveCharArray() {
273:                return new char[] { Character.MAX_VALUE, Character.MIN_VALUE,
274:                        Character.MAX_VALUE, Character.MIN_VALUE };
275:            }
276:
277:            public static double[] createPrimitiveDoubleArray() {
278:                return new double[] { Double.MAX_VALUE, Double.MIN_VALUE,
279:                        Double.MAX_VALUE, Double.MIN_VALUE };
280:            }
281:
282:            public static float[] createPrimitiveFloatArray() {
283:                return new float[] { Float.MAX_VALUE, Float.MIN_VALUE,
284:                        Float.MAX_VALUE, Float.MIN_VALUE };
285:            }
286:
287:            public static int[] createPrimitiveIntegerArray() {
288:                return new int[] { Integer.MAX_VALUE, Integer.MIN_VALUE,
289:                        Integer.MAX_VALUE, Integer.MIN_VALUE };
290:            }
291:
292:            public static long[] createPrimitiveLongArray() {
293:                return new long[] { Long.MAX_VALUE, Long.MIN_VALUE,
294:                        Long.MAX_VALUE, Long.MIN_VALUE };
295:            }
296:
297:            public static short[] createPrimitiveShortArray() {
298:                return new short[] { Short.MAX_VALUE, Short.MIN_VALUE,
299:                        Short.MAX_VALUE, Short.MIN_VALUE };
300:            }
301:
302:            public static Short[] createShortArray() {
303:                return new Short[] { new Short(Short.MAX_VALUE),
304:                        new Short(Short.MIN_VALUE), new Short(Short.MAX_VALUE),
305:                        new Short(Short.MIN_VALUE) };
306:            }
307:
308:            /*
309:             * Check names that collide with JS properties inherited from Object.prototype
310:             * to make sure they are handled properly.
311:             */
312:            public static String[] createStringArray() {
313:                return new String[] { null, "", "one", "two", "toString",
314:                        "watch", "prototype", "eval", "valueOf", "constructor",
315:                        "__proto__" };
316:            }
317:
318:            public static Vector createVector() {
319:                Vector vector = new Vector();
320:                vector.add(new SerializableNode());
321:                vector.add(new SerializableList());
322:                vector.add(new SerializableMap());
323:                vector.add(new SerializableSet());
324:                vector.add(new SerializableVector());
325:                return vector;
326:            }
327:
328:            static SerializableDoublyLinkedNode createAcyclicGraph() {
329:                SerializableDoublyLinkedNode head = new SerializableDoublyLinkedNode();
330:                head.setData("head");
331:
332:                SerializableDoublyLinkedNode leftChild = new SerializableDoublyLinkedNode();
333:                leftChild.setData("lchild");
334:
335:                SerializableDoublyLinkedNode rightChild = new SerializableDoublyLinkedNode();
336:                rightChild.setData("rchild");
337:
338:                head.setLeftChild(leftChild);
339:                head.setRightChild(rightChild);
340:
341:                return head;
342:            }
343:
344:            static ArrayList createArrayList() {
345:                ArrayList list = new ArrayList();
346:                list.add(new SerializableNode());
347:                list.add(new SerializableList());
348:                list.add(new SerializableMap());
349:                list.add(new SerializableSet());
350:                list.add(new SerializableVector());
351:                return list;
352:            }
353:
354:            static SerializableDoublyLinkedNode createComplexCyclicGraph() {
355:                SerializableDoublyLinkedNode n1 = new SerializableDoublyLinkedNode();
356:                n1.setData("n0");
357:
358:                SerializableDoublyLinkedNode n2 = new SerializableDoublyLinkedNode();
359:                n2.setData("n1");
360:
361:                SerializableDoublyLinkedNode n3 = new SerializableDoublyLinkedNode();
362:                n3.setData("n2");
363:
364:                SerializableDoublyLinkedNode n4 = new SerializableDoublyLinkedNode();
365:                n4.setData("n3");
366:
367:                n1.setLeftChild(n4);
368:                n1.setRightChild(n2);
369:                n2.setLeftChild(n1);
370:                n2.setRightChild(n3);
371:                n3.setLeftChild(n2);
372:                n3.setRightChild(n4);
373:                n4.setLeftChild(n3);
374:                n4.setRightChild(n1);
375:
376:                return n1;
377:            }
378:
379:            static SerializableClass createSerializableClass() {
380:                SerializableClass cls = new SerializableClass();
381:                IsSerializable[] elements = new IsSerializable[] {
382:                        new SerializableClass(), new SerializableClass(),
383:                        new SerializableClass(), new SerializableClass(), };
384:
385:                cls.setElements(elements);
386:                cls.setElementRef(elements[3]);
387:
388:                return cls;
389:            }
390:
391:            static SerializableDoublyLinkedNode createTrivialCyclicGraph() {
392:                SerializableDoublyLinkedNode root = new SerializableDoublyLinkedNode();
393:                root.setData("head");
394:                root.setLeftChild(root);
395:                root.setRightChild(root);
396:
397:                return root;
398:            }
399:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.