Revision 104,
586 bytes
checked in by wojtekp, 13 years ago
(diff) |
|
-
Property svn:mime-type set to
text/plain
|
Line | |
---|
1 | package test.rewolucja.resources; |
---|
2 | |
---|
3 | import java.util.ArrayList; |
---|
4 | import java.util.List; |
---|
5 | |
---|
6 | public abstract class StuctureEntity<T> implements StructureEntityInterface<T> { |
---|
7 | |
---|
8 | protected T parent; |
---|
9 | protected List<T> children; |
---|
10 | |
---|
11 | public T getParent() { |
---|
12 | return parent; |
---|
13 | } |
---|
14 | |
---|
15 | public void setParent(T newParent) { |
---|
16 | parent = newParent; |
---|
17 | } |
---|
18 | |
---|
19 | public List<T> getChildren() { |
---|
20 | return children; |
---|
21 | } |
---|
22 | |
---|
23 | @SuppressWarnings("unchecked") |
---|
24 | public void addChild(T child) { |
---|
25 | ((StuctureEntity<T>)child).setParent((T)this); |
---|
26 | if (children == null) |
---|
27 | children = new ArrayList<T>(); |
---|
28 | children.add(child); |
---|
29 | } |
---|
30 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.