testdev/ite/src/com.nokia.testfw.codegen.ui/src/com/nokia/testfw/codegen/ui/util/PathNode.java
changeset 1 96906a986c3b
equal deleted inserted replaced
0:f1112f777ce9 1:96906a986c3b
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 package com.nokia.testfw.codegen.ui.util;
       
    19 
       
    20 import java.util.HashMap;
       
    21 import java.util.Map;
       
    22 
       
    23 public class PathNode {
       
    24 	private String name;
       
    25 	private PathNode parent;
       
    26 	private Map<String, PathNode> childrenMap = new HashMap<String, PathNode>();
       
    27 	private Object data;
       
    28 
       
    29 	public PathNode(String name) {
       
    30 		this.name = name;
       
    31 	}
       
    32 
       
    33 	public String getName() {
       
    34 		return name;
       
    35 	}
       
    36 
       
    37 	public void setName(String name) {
       
    38 		this.name = name;
       
    39 	}
       
    40 
       
    41 	public PathNode getParent() {
       
    42 		return parent;
       
    43 	}
       
    44 
       
    45 	public void setParent(PathNode parent) {
       
    46 		this.parent = parent;
       
    47 	}
       
    48 
       
    49 	public void addChild(PathNode node) {
       
    50 		node.setParent(this);
       
    51 		childrenMap.put(node.name, node);
       
    52 	}
       
    53 
       
    54 	public PathNode getChild(String name) {
       
    55 		return childrenMap.get(name);
       
    56 	}
       
    57 
       
    58 	public PathNode[] getChildren() {
       
    59 		return childrenMap.values().toArray(new PathNode[0]);
       
    60 	}
       
    61 
       
    62 	public Object getData() {
       
    63 		return data;
       
    64 	}
       
    65 
       
    66 	public void setData(Object data) {
       
    67 		this.data = data;
       
    68 	}
       
    69 }