1 9 package org.jboss.portal.core.impl.tree; 10 11 import org.jboss.portal.common.FQN; 12 import org.jboss.portal.common.tree.Node; 13 import org.jboss.cache.Fqn; 14 15 import java.util.Map ; 16 import java.util.HashMap ; 17 18 24 public class NodeImpl 25 implements Node 26 { 27 28 29 final Map ids; 30 31 32 final TreeImpl model; 33 34 35 final FQN id; 36 37 38 final Fqn fqn; 39 40 NodeImpl(TreeImpl model, Fqn fqn) 41 { 42 this.ids = new HashMap (); 43 this.model = model; 44 this.id = TreeImpl.toFQN(fqn); 45 this.fqn = fqn; 46 } 47 48 public FQN getID() 49 { 50 return id; 51 } 52 53 public String getName() 54 { 55 return id.getName(id.size() - 1); 56 } 57 58 public Object getProperty(String name) 59 { 60 return model.getProperty(this, name); 61 } 62 63 public Node getChild(String key) 64 { 65 return model.getChild(this, key); 66 } 67 68 public Map getChildren() 69 { 70 return model.getChildren(this); 71 } 72 73 public boolean equals(Object obj) 74 { 75 if (obj == this) 76 { 77 return true; 78 } 79 if (obj instanceof NodeImpl) 80 { 81 NodeImpl other = (NodeImpl)obj; 82 return fqn.equals(other.fqn); 83 } 84 return false; 85 } 86 87 public int hashCode() 88 { 89 return fqn.hashCode(); 90 } 91 92 public String toString() 93 { 94 return "Node[" + fqn.toString() + "]"; 95 } 96 } 97 | Popular Tags |