Author: chatellier Date: 2011-01-06 13:19:35 +0000 (Thu, 06 Jan 2011) New Revision: 477 Log: Ajout d'une nouvelle methode iterator() qui skip le header csv. Update doc Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/storage/DataStorage.java trunk/coser-business/src/main/java/fr/ifremer/coser/storage/MemoryDataStorage.java Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/storage/DataStorage.java =================================================================== --- trunk/coser-business/src/main/java/fr/ifremer/coser/storage/DataStorage.java 2011-01-06 12:59:40 UTC (rev 476) +++ trunk/coser-business/src/main/java/fr/ifremer/coser/storage/DataStorage.java 2011-01-06 13:19:35 UTC (rev 477) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2010 Codelutin, Chatellier Eric + * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -25,13 +25,14 @@ package fr.ifremer.coser.storage; +import java.util.Iterator; import java.util.List; /** * Data storage utiliser pour manipuler dans l'application des * tableau de String, mais les stocker en back différement. * - * Cet interface respecte globalement l'interface d'une {@link List}. + * Cette interface respecte globalement l'interface d'une {@link List}. * * @author chatellier * @version $Revision$ @@ -46,7 +47,7 @@ * * @param data data to add */ - void add(String[] data); + public void add(String[] data); /** * Add new data into storage. @@ -54,7 +55,7 @@ * @param index index to insert data * @param data data to add */ - void add(int index, String[] data); + public void add(int index, String[] data); /** * Get data at specified index. @@ -62,13 +63,46 @@ * @param index index * @return data at index */ - String[] get(int index); - - int size(); + public String[] get(int index); - String[] set(int index, String[] data); - - String[] remove(int index); - + /** + * Storage size. + * + * @return storage size + */ + public int size(); + + /** + * Replace data at specified index. + * + * @param index index + * @param data data to set + * @return previous value + */ + public String[] set(int index, String[] data); + + /** + * Remove value at index. + * + * @param index index + * @return removed value + */ + public String[] remove(int index); + + /** + * Real storage index of lineNumber. + * + * @param lineNumber line number + * @return storage index + */ public int indexOf(String lineNumber); + + /** + * Return a new iterator, but skip first iterator element (csv header) + * by calling {@code next()} once. + * + * @param skipFirstLine if {@code true}, skip first line + * @return an Iterator. + */ + public Iterator<String[]> iterator(boolean skipFirstLine); } Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/storage/MemoryDataStorage.java =================================================================== --- trunk/coser-business/src/main/java/fr/ifremer/coser/storage/MemoryDataStorage.java 2011-01-06 12:59:40 UTC (rev 476) +++ trunk/coser-business/src/main/java/fr/ifremer/coser/storage/MemoryDataStorage.java 2011-01-06 13:19:35 UTC (rev 477) @@ -121,6 +121,7 @@ * @param skipFirstLine if {@code true}, skip first line * @return an Iterator. */ + @Override public Iterator<String[]> iterator(boolean skipFirstLine) { Iterator<String[]> iterator = new StringListIterator(listStorage.iterator(), lineIndexStorage.iterator()); if (skipFirstLine) {
participants (1)
-
chatellier@users.labs.libre-entreprise.org