Class ArrayListVisitor

 1 /*
 2  * Copyright (c) 2016 Vivid Solutions.
 3  *
 4  * All rights reserved. This program and the accompanying materials
 5  * are made available under the terms of the Eclipse Public License 2.0
 6  * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
 7  * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v20.html
 8  * and the Eclipse Distribution License is available at
 9  *
10  * http://www.eclipse.org/org/documents/edl-v10.php.
11  */
12  
13 package org.locationtech.jts.index;
14  
15 import java.util.ArrayList;
16  
17 /**
18  * Builds an array of all visited items.
19  * 
20  * @version 1.7
21  */
22 public class ArrayListVisitor
23     implements ItemVisitor
24 {
25  
26   private ArrayList items = new ArrayList();
27   
28   /**
29    * Creates a new instance.
30    */
31   public ArrayListVisitor() {
32   }
33  
34   /**
35    * Visits an item.
36    * 
37    * @param item the item to visit
38    */
39   public void visitItem(Object item)
40   {
41     items.add(item);
42   }
43  
44   /**
45    * Gets the array of visited items.
46    * 
47    * @return the array of items
48    */
49   public ArrayList getItems() { return items; }
50  
51 }
52