001package conexp.fx.core.xml; 002 003/* 004 * #%L 005 * Concept Explorer FX 006 * %% 007 * Copyright (C) 2010 - 2023 Francesco Kriegel 008 * %% 009 * This program is free software: you can redistribute it and/or modify 010 * it under the terms of the GNU General Public License as 011 * published by the Free Software Foundation, either version 3 of the 012 * License, or (at your option) any later version. 013 * 014 * This program is distributed in the hope that it will be useful, 015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 017 * GNU General Public License for more details. 018 * 019 * You should have received a copy of the GNU General Public 020 * License along with this program. If not, see 021 * <http://www.gnu.org/licenses/gpl-3.0.html>. 022 * #L% 023 */ 024 025 026import java.util.ArrayList; 027import java.util.Collection; 028import java.util.Collections; 029import java.util.Iterator; 030import java.util.List; 031import java.util.ListIterator; 032 033public class ListData<T> extends Data<List<T>> implements List<T> { 034 035 protected final String subkey; 036 037 public ListData(final Datatype type, final String key, final String subkey, final List<T> value) 038 throws NullPointerException, IndexOutOfBoundsException { 039 super(type, key, Collections.synchronizedList(new ArrayList<T>(value))); 040 this.subkey = subkey; 041 } 042 043 public final String getSubkey() { 044 return subkey; 045 } 046 047 @Override 048 public boolean add(T value) { 049 return this.value.add(value); 050 } 051 052 @Override 053 public void add(int index, T value) { 054 this.value.add(index, value); 055 } 056 057 @Override 058 public T set(int index, T value) { 059 return this.value.set(index, value); 060 } 061 062 @Override 063 public T get(int index) { 064 return value.get(index); 065 } 066 067 @Override 068 public T remove(int index) { 069 return value.remove(index); 070 } 071 072 @Override 073 public boolean remove(Object object) { 074 return value.remove(object); 075 } 076 077 @Override 078 public boolean contains(Object object) { 079 return this.value.contains(object); 080 } 081 082 @Override 083 public int indexOf(Object object) { 084 return this.value.indexOf(object); 085 } 086 087 @Override 088 public int lastIndexOf(Object object) { 089 return value.lastIndexOf(object); 090 } 091 092 @Override 093 public boolean addAll(Collection<? extends T> collection) { 094 return value.addAll(collection); 095 } 096 097 @Override 098 public boolean addAll(int index, Collection<? extends T> collection) { 099 return value.addAll(index, collection); 100 } 101 102 @Override 103 public boolean removeAll(Collection<?> collection) { 104 return value.removeAll(collection); 105 } 106 107 @Override 108 public boolean retainAll(Collection<?> collection) { 109 return value.retainAll(collection); 110 } 111 112 @Override 113 public boolean containsAll(Collection<?> collection) { 114 return value.containsAll(collection); 115 } 116 117 @Override 118 public void clear() { 119 value.clear(); 120 } 121 122 @Override 123 public boolean isEmpty() { 124 return value.isEmpty(); 125 } 126 127 @Override 128 public int size() { 129 return value.size(); 130 } 131 132 @Override 133 public Iterator<T> iterator() { 134 return value.iterator(); 135 } 136 137 @Override 138 public ListIterator<T> listIterator() { 139 return value.listIterator(); 140 } 141 142 @Override 143 public ListIterator<T> listIterator(int index) { 144 return value.listIterator(index); 145 } 146 147 @Override 148 public List<T> subList(int fromIndex, int toIndex) { 149 return value.subList(fromIndex, toIndex); 150 } 151 152 @Override 153 public Object[] toArray() { 154 return value.toArray(); 155 } 156 157 @Override 158 public <t> t[] toArray(t[] array) { 159 return value.<t> toArray(array); 160 } 161 162}