KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > cache > pojo > test > propagation > impl > NodeImpl


1 package org.jboss.cache.pojo.test.propagation.impl;
2
3 import org.jboss.cache.pojo.test.propagation.Node;
4 import org.jboss.cache.pojo.test.propagation.PropagationRule;
5 import org.jboss.cache.pojo.test.propagation.StateItem;
6
7 import java.util.ArrayList JavaDoc;
8 import java.util.List JavaDoc;
9
10 public class NodeImpl implements Node
11 {
12    private String JavaDoc rdn_;
13
14    private String JavaDoc fdn_;
15
16    private List JavaDoc childNodes_ = new ArrayList JavaDoc();
17
18    private Node parentNode_;
19
20    private List JavaDoc stateItems_ = new ArrayList JavaDoc();
21
22    private StateItem summaryItem_;
23
24    private transient PropagationRule rule_;
25
26    public NodeImpl()
27    {
28       rule_ = PropagationRuleFactory.getPropagationRule();
29    }
30
31    public void setNodeRDN(String JavaDoc rdn)
32    {
33       this.rdn_ = rdn;
34    }
35
36    public String JavaDoc getNodeRDN()
37    {
38       return this.rdn_;
39    }
40
41    public void setNodeFDN(String JavaDoc fdn)
42    {
43       this.fdn_ = fdn;
44    }
45
46    public String JavaDoc getNodeFDN()
47    {
48       return this.fdn_;
49    }
50
51    public void addChildNode(Node child)
52    {
53       childNodes_.add(child);
54    }
55
56    public List JavaDoc getChildren()
57    {
58       return childNodes_;
59    }
60
61    public void setParentNode(Node parent)
62    {
63       parentNode_ = parent;
64    }
65
66    public Node getParentNode()
67    {
68       return this.parentNode_;
69    }
70
71    public void addStateItem(StateItem stateItem)
72    {
73       stateItems_.add(stateItem);
74    }
75
76    public void setSummaryStateItem(StateItem stateItem)
77    {
78       this.summaryItem_ = stateItem;
79    }
80
81    public StateItem getSummaryStateItem()
82    {
83       return this.summaryItem_;
84    }
85
86    public void setPropagationRule(PropagationRule rule)
87    {
88       this.rule_ = rule;
89    }
90
91    public PropagationRule getPropagationRule()
92    {
93       return rule_;
94    }
95
96
97    public List JavaDoc getStateItems()
98    {
99       return this.stateItems_;
100    }
101
102    public StateItem findStateItem(long itemId)
103    {
104       StateItem retItem = null;
105       int size = stateItems_.size();
106       for (int idx = 0; idx < size; idx++)
107       {
108          StateItem stateItem = (StateItem) stateItems_.get(idx);
109          if (stateItem.getItemId() == itemId)
110          {
111             retItem = stateItem;
112             break;
113          }
114       }
115
116       return retItem;
117    }
118
119    public String JavaDoc toString()
120    {
121       return getNodeFDN();
122    }
123 }
124
Popular Tags