1 // 2 // Copyright (c) 2004, International Decision Systems 3 // all rights reserved 4 /* 5 * Copyright (c) 2004 International Decision Systems, Inc. All Rights Reserved. 6 * 7 * By using this Software, You acknowledge that the Software is a valuable asset 8 * and trade secret of either International Decision Systems, Inc. ("IDSI") or a 9 * third party supplier of IDSI and constitutes confidential and proprietary 10 * information. 11 * 12 * NEITHER IDSI NOR ANY AGENT OR PERSON ACTING FOR OR WITH IDSI HAS MADE OR DOES 13 * MAKE ANY STATEMENTS, AFFIRMATIONS, REPRESENTATIONS OR WARRANTIES WHATSOEVER 14 * TO YOU, WHETHER EXPRESS OR IMPLIED, AS TO THE SOFTWARE, THE QUALITY OR 15 * CONDITION OF THE SOFTWARE, OR THE OPERATING CHARACTERISTICS OR RELIABILITY OF 16 * THE SOFTWARE, OR ITS SUITABILITY FOR ANY GENERAL OR PARTICULAR PURPOSE, OR AS 17 * TO ANY OTHER MATTER WHATSOEVER; ANY AND ALL OTHER WARRANTIES INCLUDING 18 * WITHOUT LIMITATION ANY WARRANTIES IMPLIED BY LAW, SUCH AS THE IMPLIED 19 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND TITLE, 20 * USE AND NON-INFRINGEMENT; ARE HEREBY EXPRESSLY DISCLAIMED AND EXCLUDED. 21 */ 22 package net.sourceforge.addam.ddlrun.filters; 23 24 import java.util.ArrayList; 25 import java.util.List; 26 import java.util.Iterator; 27 28 /** 29 * Returns all scripts after a specific starting point -- used with DeploymentRunner for upgrades. 30 * 31 * @author TIM3 32 * @since Mar 5, 2005 33 */ 34 public class StartPointFilter implements Filter { 35 36 public StartPointFilter(String startPoint) { 37 this.startPoint = startPoint; 38 } 39 40 public Iterator getIterator(List collection) { 41 List subList = new ArrayList(); 42 if (collection.contains(startPoint)) { 43 for (int i = collection.indexOf(startPoint); i < collection.size(); i++) { 44 String line = collection.get(i).toString().trim(); 45 if (line.length() > 0 && !line.startsWith(COMMENT_PREFIX)) { 46 subList.add(line); 47 } 48 } 49 } 50 return subList.iterator(); 51 } 52 53 private final String startPoint; 54 }