%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.jetspeed.om.page.psml.FragmentList |
|
|
1 | /* |
|
2 | * Licensed to the Apache Software Foundation (ASF) under one or more |
|
3 | * contributor license agreements. See the NOTICE file distributed with |
|
4 | * this work for additional information regarding copyright ownership. |
|
5 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
6 | * (the "License"); you may not use this file except in compliance with |
|
7 | * the License. You may obtain a copy of the License at |
|
8 | * |
|
9 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
10 | * |
|
11 | * Unless required by applicable law or agreed to in writing, software |
|
12 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
14 | * See the License for the specific language governing permissions and |
|
15 | * limitations under the License. |
|
16 | */ |
|
17 | package org.apache.jetspeed.om.page.psml; |
|
18 | ||
19 | import java.util.AbstractList; |
|
20 | ||
21 | /** |
|
22 | * FragmentList |
|
23 | * |
|
24 | * @author <a href="mailto:rwatler@apache.org">Randy Watler</a> |
|
25 | * @version $Id$ |
|
26 | */ |
|
27 | class FragmentList extends AbstractList |
|
28 | { |
|
29 | private FragmentImpl fragment; |
|
30 | ||
31 | FragmentList(FragmentImpl fragment) |
|
32 | { |
|
33 | 0 | super(); |
34 | 0 | this.fragment = fragment; |
35 | 0 | } |
36 | ||
37 | /* (non-Javadoc) |
|
38 | * @see java.util.List#add(int,java.lang.Object) |
|
39 | */ |
|
40 | public void add(int index, Object element) |
|
41 | { |
|
42 | // implement for modifiable AbstractList: |
|
43 | // add and maintain page implementation reference |
|
44 | 0 | fragment.accessFragments().add(index, element); |
45 | 0 | if ((fragment.getPage() != null) && (element instanceof FragmentImpl)) |
46 | { |
|
47 | 0 | ((FragmentImpl)element).setPage(fragment.getPage()); |
48 | } |
|
49 | 0 | } |
50 | ||
51 | /* (non-Javadoc) |
|
52 | * @see java.util.List#get(int) |
|
53 | */ |
|
54 | public Object get(int index) |
|
55 | { |
|
56 | // implement for modifiable AbstractList |
|
57 | 0 | return fragment.accessFragments().get(index); |
58 | } |
|
59 | ||
60 | /* (non-Javadoc) |
|
61 | * @see java.util.List#remove(int) |
|
62 | */ |
|
63 | public Object remove(int index) |
|
64 | { |
|
65 | // implement for modifiable AbstractList |
|
66 | 0 | return fragment.accessFragments().remove(index); |
67 | } |
|
68 | ||
69 | /* (non-Javadoc) |
|
70 | * @see java.util.List#set(int,java.lang.Object) |
|
71 | */ |
|
72 | public Object set(int index, Object element) |
|
73 | { |
|
74 | // implement for modifiable AbstractList: |
|
75 | // set and maintain page implementation reference |
|
76 | 0 | Object o = fragment.accessFragments().set(index, element); |
77 | 0 | if ((fragment.getPage() != null) && (element instanceof FragmentImpl)) |
78 | { |
|
79 | 0 | ((FragmentImpl)element).setPage(fragment.getPage()); |
80 | } |
|
81 | 0 | return o; |
82 | } |
|
83 | ||
84 | /* (non-Javadoc) |
|
85 | * @see java.util.List#size() |
|
86 | */ |
|
87 | public int size() |
|
88 | { |
|
89 | // implement for modifiable AbstractList |
|
90 | 0 | return fragment.accessFragments().size(); |
91 | } |
|
92 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |