Rev 1306 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
671 | jmachado | 1 | /* |
2 | * Copyright 2003-2004 The Apache Software Foundation |
||
3 | * |
||
4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
||
5 | * you may not use this file except in compliance with the License. |
||
6 | * You may obtain a copy of the License at |
||
7 | * |
||
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
||
9 | * |
||
10 | * Unless required by applicable law or agreed to in writing, software |
||
11 | * distributed under the License is distributed on an "AS IS" BASIS, |
||
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||
13 | * See the License for the specific language governing permissions and |
||
14 | * limitations under the License. |
||
15 | */ |
||
16 | package pt.estgp.estgweb.utils; |
||
17 | |||
18 | import java.util.Collection; |
||
19 | import java.util.List; |
||
20 | import java.util.ListIterator; |
||
21 | |||
22 | /** |
||
23 | * Decorates another <code>List</code> to provide additional behaviour. |
||
24 | * <p> |
||
25 | * Methods are forwarded directly to the decorated list. |
||
26 | * |
||
27 | * @since Commons Collections 3.0 |
||
28 | * @version $Revision: 1.4 $ $Date: 2004/06/02 21:53:02 $ |
||
29 | * |
||
30 | * @author Stephen Colebourne |
||
31 | */ |
||
32 | public abstract class AbstractListDecorator extends AbstractCollectionDecorator implements 5+0%2Fdocs%2Fapi+List">List { |
||
33 | |||
34 | /** |
||
35 | * Constructor only used in deserialization, do not use otherwise. |
||
36 | * @since Commons Collections 3.1 |
||
37 | */ |
||
38 | protected AbstractListDecorator() { |
||
39 | super(); |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Constructor that wraps (not copies). |
||
44 | * |
||
45 | * @param list the list to decorate, must not be null |
||
46 | * @throws IllegalArgumentException if list is null |
||
47 | */ |
||
48 | protected AbstractListDecorator(5+0%2Fdocs%2Fapi+List">List list) { |
||
49 | super(list); |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * Gets the list being decorated. |
||
54 | * |
||
55 | * @return the decorated list |
||
56 | */ |
||
57 | protected 5+0%2Fdocs%2Fapi+List">List getList() { |
||
58 | return (5+0%2Fdocs%2Fapi+List">List) getCollection(); |
||
59 | } |
||
60 | |||
61 | //----------------------------------------------------------------------- |
||
62 | public void add(int index, 5+0%2Fdocs%2Fapi+Object">Object object) { |
||
63 | getList().add(index, object); |
||
64 | } |
||
65 | |||
66 | public boolean addAll(int index, 1.5.0/docs/api/java/util/Collection.html">Collection coll) { |
||
67 | return getList().addAll(index, coll); |
||
68 | } |
||
69 | |||
70 | public 5+0%2Fdocs%2Fapi+Object">Object get(int index) { |
||
71 | return getList().get(index); |
||
72 | } |
||
73 | |||
74 | public int indexOf(5+0%2Fdocs%2Fapi+Object">Object object) { |
||
75 | return getList().indexOf(object); |
||
76 | } |
||
77 | |||
78 | public int lastIndexOf(5+0%2Fdocs%2Fapi+Object">Object object) { |
||
79 | return getList().lastIndexOf(object); |
||
80 | } |
||
81 | |||
82 | public 1.5.0/docs/api/java/util/ListIterator.html">ListIterator listIterator() { |
||
83 | return getList().listIterator(); |
||
84 | } |
||
85 | |||
86 | public 1.5.0/docs/api/java/util/ListIterator.html">ListIterator listIterator(int index) { |
||
87 | return getList().listIterator(index); |
||
88 | } |
||
89 | |||
90 | public 5+0%2Fdocs%2Fapi+Object">Object remove(int index) { |
||
91 | return getList().remove(index); |
||
92 | } |
||
93 | |||
94 | public 5+0%2Fdocs%2Fapi+Object">Object set(int index, 5+0%2Fdocs%2Fapi+Object">Object object) { |
||
95 | return getList().set(index, object); |
||
96 | } |
||
97 | |||
98 | public 5+0%2Fdocs%2Fapi+List">List subList(int fromIndex, int toIndex) { |
||
99 | return getList().subList(fromIndex, toIndex); |
||
100 | } |
||
101 | |||
102 | } |