1 4 package com.openedit.hittracker; 5 6 import java.io.IOException ; 7 import java.util.ArrayList ; 8 import java.util.Collection ; 9 import java.util.Iterator ; 10 import java.util.List ; 11 12 13 17 public class ListHitTracker extends HitTracker 18 { 19 protected List fieldHits; 20 21 public ListHitTracker() 22 { 23 24 } 25 26 public ListHitTracker(List inHits) 27 { 28 setHits(inHits); 29 } 30 31 public List getHits() 32 { 33 if (fieldHits == null) 34 { 35 fieldHits = new ArrayList (); 36 } 37 return fieldHits; 38 } 39 40 public void setHits(List inObjects) 41 { 42 fieldHits = inObjects; 43 } 44 45 public void addHit(Object inObject) 46 { 47 getHits().add(inObject); 48 } 49 50 public void addAll(Collection inCollection) 51 { 52 getHits().addAll(inCollection); 53 } 54 55 public int getTotal() 56 { 57 if ( getHits() == null ) 58 { 59 return 0; 60 } 61 else 62 { 63 return getHits().size(); 64 } 65 } 66 67 public Object get(int count) throws IOException 68 { 69 return getHits().get(count); 70 } 71 72 public Iterator getAllHits() 73 { 74 return getHits().iterator(); 75 } 76 77 public boolean contains(Object inHit) 78 { 79 return getHits().contains(inHit); 80 } 81 } 82 | Popular Tags |