001/* 002 * Copyright 2020 nils.hoffmann. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package de.isas.lipidomics.domain; 017 018import java.util.ArrayList; 019import java.util.Collection; 020import java.util.Collections; 021import java.util.Comparator; 022import java.util.Iterator; 023import java.util.List; 024import java.util.ListIterator; 025import java.util.Spliterator; 026import java.util.function.Consumer; 027import java.util.function.IntFunction; 028import java.util.function.Predicate; 029import java.util.function.UnaryOperator; 030import java.util.stream.Stream; 031import lombok.EqualsAndHashCode; 032import org.apache.commons.lang3.tuple.Pair; 033 034/** 035 * 036 * @author nils.hoffmann 037 */ 038@EqualsAndHashCode 039public class ModificationsList implements List<Pair<Integer,String>> { 040 041 protected static final ModificationsList NONE = new ModificationsList(Collections.emptyList()); 042 043 public ModificationsList() { 044 this.al = new ArrayList<>(); 045 } 046 047 public ModificationsList(List<Pair<Integer, String>> list) { 048 this.al = list; 049 } 050 051 private final List<Pair<Integer, String>> al; 052 053 @Override 054 public int size() { 055 return al.size(); 056 } 057 058 @Override 059 public boolean isEmpty() { 060 return al.isEmpty(); 061 } 062 063 @Override 064 public boolean contains(Object o) { 065 return al.contains(o); 066 } 067 068 @Override 069 public int indexOf(Object o) { 070 return al.indexOf(o); 071 } 072 073 @Override 074 public int lastIndexOf(Object o) { 075 return al.lastIndexOf(o); 076 } 077 078 @Override 079 public Object[] toArray() { 080 return al.toArray(); 081 } 082 083 @Override 084 public <T> T[] toArray(T[] a) { 085 return al.toArray(a); 086 } 087 088 @Override 089 public Pair<Integer, String> get(int index) { 090 return al.get(index); 091 } 092 093 @Override 094 public Pair<Integer, String> set(int index, Pair<Integer, String> element) { 095 return al.set(index, element); 096 } 097 098 @Override 099 public boolean add(Pair<Integer, String> e) { 100 return al.add(e); 101 } 102 103 @Override 104 public void add(int index, Pair<Integer, String> element) { 105 al.add(index, element); 106 } 107 108 @Override 109 public Pair<Integer, String> remove(int index) { 110 return al.remove(index); 111 } 112 113 @Override 114 public boolean remove(Object o) { 115 return al.remove(o); 116 } 117 118 @Override 119 public void clear() { 120 al.clear(); 121 } 122 123 @Override 124 public boolean addAll(Collection<? extends Pair<Integer, String>> c) { 125 return al.addAll(c); 126 } 127 128 @Override 129 public boolean addAll(int index, Collection<? extends Pair<Integer, String>> c) { 130 return al.addAll(index, c); 131 } 132 133 @Override 134 public boolean removeAll(Collection<?> c) { 135 return al.removeAll(c); 136 } 137 138 @Override 139 public boolean retainAll(Collection<?> c) { 140 return al.retainAll(c); 141 } 142 143 @Override 144 public ListIterator<Pair<Integer, String>> listIterator(int index) { 145 return al.listIterator(index); 146 } 147 148 @Override 149 public ListIterator<Pair<Integer, String>> listIterator() { 150 return al.listIterator(); 151 } 152 153 @Override 154 public Iterator<Pair<Integer, String>> iterator() { 155 return al.iterator(); 156 } 157 158 @Override 159 public List<Pair<Integer, String>> subList(int fromIndex, int toIndex) { 160 return al.subList(fromIndex, toIndex); 161 } 162 163 @Override 164 public void forEach(Consumer<? super Pair<Integer, String>> action) { 165 al.forEach(action); 166 } 167 168 @Override 169 public Spliterator<Pair<Integer, String>> spliterator() { 170 return al.spliterator(); 171 } 172 173 @Override 174 public boolean removeIf(Predicate<? super Pair<Integer, String>> filter) { 175 return al.removeIf(filter); 176 } 177 178 @Override 179 public void replaceAll(UnaryOperator<Pair<Integer, String>> operator) { 180 al.replaceAll(operator); 181 } 182 183 @Override 184 public void sort(Comparator<? super Pair<Integer, String>> c) { 185 al.sort(c); 186 } 187 188 @Override 189 public boolean containsAll(Collection<?> c) { 190 return al.containsAll(c); 191 } 192 193 @Override 194 public String toString() { 195 return al.toString(); 196 } 197 198 @Override 199 public <T> T[] toArray(IntFunction<T[]> generator) { 200 return al.toArray(generator); 201 } 202 203 @Override 204 public Stream<Pair<Integer, String>> stream() { 205 return al.stream(); 206 } 207 208 @Override 209 public Stream<Pair<Integer, String>> parallelStream() { 210 return al.parallelStream(); 211 } 212 213}