Commit | Line | Data |
---|---|---|
8f34a795 NR |
1 | package be.nikiroo.jexer; |
2 | ||
3 | import java.util.Collection; | |
4 | import java.util.Iterator; | |
5 | import java.util.List; | |
6 | import java.util.ListIterator; | |
7 | ||
8 | public class TTableLine implements List<String> { | |
9 | //TODO: in TTable: default to header of size 1 | |
10 | private List<String> list; | |
11 | ||
12 | public TTableLine(List<String> list) { | |
13 | this.list = list; | |
14 | } | |
15 | ||
16 | // TODO: override this and the rest shall follow | |
17 | protected List<String> getList() { | |
18 | return list; | |
19 | } | |
20 | ||
21 | @Override | |
22 | public int size() { | |
23 | return getList().size(); | |
24 | } | |
25 | ||
26 | @Override | |
27 | public boolean isEmpty() { | |
28 | return getList().isEmpty(); | |
29 | } | |
30 | ||
31 | @Override | |
32 | public boolean contains(Object o) { | |
33 | return getList().contains(o); | |
34 | } | |
35 | ||
36 | @Override | |
37 | public Iterator<String> iterator() { | |
38 | return getList().iterator(); | |
39 | } | |
40 | ||
41 | @Override | |
42 | public Object[] toArray() { | |
43 | return getList().toArray(); | |
44 | } | |
45 | ||
46 | @Override | |
47 | public <T> T[] toArray(T[] a) { | |
48 | return getList().toArray(a); | |
49 | } | |
50 | ||
51 | @Override | |
52 | public boolean containsAll(Collection<?> c) { | |
53 | return getList().containsAll(c); | |
54 | } | |
55 | ||
56 | @Override | |
57 | public String get(int index) { | |
58 | return getList().get(index); | |
59 | } | |
60 | ||
61 | @Override | |
62 | public int indexOf(Object o) { | |
63 | return getList().indexOf(o); | |
64 | } | |
65 | ||
66 | @Override | |
67 | public int lastIndexOf(Object o) { | |
68 | return getList().lastIndexOf(o); | |
69 | } | |
70 | ||
71 | @Override | |
72 | public List<String> subList(int fromIndex, int toIndex) { | |
73 | return getList().subList(fromIndex, toIndex); | |
74 | } | |
75 | ||
76 | @Override | |
77 | public ListIterator<String> listIterator() { | |
78 | return getList().listIterator(); | |
79 | } | |
80 | ||
81 | @Override | |
82 | public ListIterator<String> listIterator(int index) { | |
83 | return getList().listIterator(index); | |
84 | } | |
85 | ||
86 | @Override | |
87 | public boolean add(String e) { | |
88 | throw new UnsupportedOperationException("Read-only collection"); | |
89 | } | |
90 | ||
91 | @Override | |
92 | public boolean remove(Object o) { | |
93 | throw new UnsupportedOperationException("Read-only collection"); | |
94 | } | |
95 | ||
96 | @Override | |
97 | public boolean addAll(Collection<? extends String> c) { | |
98 | throw new UnsupportedOperationException("Read-only collection"); | |
99 | } | |
100 | ||
101 | @Override | |
102 | public boolean addAll(int index, Collection<? extends String> c) { | |
103 | throw new UnsupportedOperationException("Read-only collection"); | |
104 | } | |
105 | ||
106 | @Override | |
107 | public boolean removeAll(Collection<?> c) { | |
108 | throw new UnsupportedOperationException("Read-only collection"); | |
109 | } | |
110 | ||
111 | @Override | |
112 | public boolean retainAll(Collection<?> c) { | |
113 | throw new UnsupportedOperationException("Read-only collection"); | |
114 | } | |
115 | ||
116 | @Override | |
117 | public void clear() { | |
118 | throw new UnsupportedOperationException("Read-only collection"); | |
119 | } | |
120 | ||
121 | @Override | |
122 | public String set(int index, String element) { | |
123 | throw new UnsupportedOperationException("Read-only collection"); | |
124 | } | |
125 | ||
126 | @Override | |
127 | public void add(int index, String element) { | |
128 | throw new UnsupportedOperationException("Read-only collection"); | |
129 | } | |
130 | ||
131 | @Override | |
132 | public String remove(int index) { | |
133 | throw new UnsupportedOperationException("Read-only collection"); | |
134 | } | |
135 | } |