01: /*******************************************************************************
02: * Copyright (c) 2004, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.examples.jobs.views;
11:
12: import java.util.*;
13:
14: import org.eclipse.core.runtime.PlatformObject;
15:
16: public class SlowElement extends PlatformObject {
17: private String name;
18: private SlowElement parent;
19:
20: SlowElement(String name) {
21: this (null, name, null);
22: }
23:
24: SlowElement(String name, SlowElement[] children) {
25: this (null, name, children);
26: }
27:
28: SlowElement(SlowElement parent, String name, SlowElement[] children) {
29: this .name = name;
30: this .parent = parent;
31: }
32:
33: public String getName() {
34: return name;
35: }
36:
37: public SlowElement getParent() {
38: return parent;
39: }
40:
41: public SlowElement[] getChildren() {
42: Random r = new Random();
43: int random = r.nextInt(15);
44: List children = new ArrayList();
45: for (int i = 0; i < random; i++) {
46: children.add(new SlowElement("child" + i)); //$NON-NLS-1$
47: }
48: return (SlowElement[]) children
49: .toArray(new SlowElement[children.size()]);
50: }
51: }
|