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