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.Arrays; 027import java.util.Collection; 028import java.util.Iterator; 029import java.util.List; 030import java.util.ListIterator; 031 032import com.google.common.base.Function; 033import com.google.common.collect.Lists; 034 035public class IntegerListData extends ListData<Integer> { 036 037 public IntegerListData(final String key, final String subkey, final List<Integer> value) throws NullPointerException, 038 IndexOutOfBoundsException { 039 super(Datatype.INTEGER_LIST, key, subkey, value); 040 } 041 042 public IntegerListData(final String key, final String subkey, final Integer... values) throws NullPointerException, 043 IndexOutOfBoundsException { 044 this(key, subkey, Arrays.asList(values)); 045 } 046 047 public IntegerListData(final String key, final String subkey, final Void v, final List<String> value) 048 throws NullPointerException, IndexOutOfBoundsException { 049 this(key, subkey, Lists.transform(value, STRING_TO_INTEGER_FUNCTION)); 050 } 051 052 public IntegerListData(final String key, final String subkey, final Void v, final String... values) 053 throws NullPointerException, IndexOutOfBoundsException { 054 this(key, subkey, Lists.transform(Arrays.asList(values), STRING_TO_INTEGER_FUNCTION)); 055 } 056 057 private static final Function<String, Integer> STRING_TO_INTEGER_FUNCTION = new Function<String, Integer>() { 058 059 @Override 060 public final Integer apply( 061 final String value) { 062 return Integer.valueOf(value); 063 } 064 }; 065 066 @Override 067 public final boolean add(Integer value) { 068 return this.value.add(value); 069 } 070 071 @Override 072 public final void add(int index, Integer value) { 073 this.value.add(index, value); 074 } 075 076 @Override 077 public final Integer set(int index, Integer value) { 078 return this.value.set(index, value); 079 } 080 081 @Override 082 public final Integer get(int index) { 083 return value.get(index); 084 } 085 086 @Override 087 public final Integer remove(int index) { 088 return value.remove(index); 089 } 090 091 @Override 092 public final boolean remove(Object object) { 093 return value.remove(object); 094 } 095 096 @Override 097 public final boolean contains(Object object) { 098 return this.value.contains(object); 099 } 100 101 @Override 102 public final int indexOf(Object object) { 103 return this.value.indexOf(object); 104 } 105 106 @Override 107 public final int lastIndexOf(Object object) { 108 return value.lastIndexOf(object); 109 } 110 111 @Override 112 public final boolean addAll(Collection<? extends Integer> collection) { 113 return value.addAll(collection); 114 } 115 116 @Override 117 public final boolean addAll(int index, Collection<? extends Integer> collection) { 118 return value.addAll(index, collection); 119 } 120 121 @Override 122 public final boolean removeAll(Collection<?> collection) { 123 return value.removeAll(collection); 124 } 125 126 @Override 127 public final boolean retainAll(Collection<?> collection) { 128 return value.retainAll(collection); 129 } 130 131 @Override 132 public final boolean containsAll(Collection<?> collection) { 133 return value.containsAll(collection); 134 } 135 136 @Override 137 public final void clear() { 138 value.clear(); 139 } 140 141 @Override 142 public final boolean isEmpty() { 143 return value.isEmpty(); 144 } 145 146 @Override 147 public final int size() { 148 return value.size(); 149 } 150 151 @Override 152 public final Iterator<Integer> iterator() { 153 return value.iterator(); 154 } 155 156 @Override 157 public final ListIterator<Integer> listIterator() { 158 return value.listIterator(); 159 } 160 161 @Override 162 public final ListIterator<Integer> listIterator(int index) { 163 return value.listIterator(index); 164 } 165 166 @Override 167 public final List<Integer> subList(int fromIndex, int toIndex) { 168 return value.subList(fromIndex, toIndex); 169 } 170 171 @Override 172 public final Object[] toArray() { 173 return value.toArray(); 174 } 175 176 @Override 177 public final <T> T[] toArray(T[] array) { 178 return value.<T> toArray(array); 179 } 180 181}