KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > propagation > impl > NodeImpl


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