View Javadoc

1   /*
2   MadCaching is a Tile Caching solution
3   Copyright (C) 2005  Mac Vu
4   
5   This program is free software; you can redistribute it and/or
6   modify it under the terms of the GNU General Public License
7   as published by the Free Software Foundation; either version 2
8   of the License, or (at your option) any later version.
9   
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  GNU General Public License for more details.
14  
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18   */
19  package com.macvu.tiles.capture;
20  
21  import com.macvu.tiles.CacheAttribute;
22  
23  import java.util.Map;
24  import java.util.List;
25  import java.util.HashMap;
26  import java.util.ArrayList;
27  
28  public class TileAnalyzeCapture {
29      int numCalls;       // number of times the tiles has ran.
30      Map useAttribute;   // attribute map of all the attributes that were used by the tiles.
31      List checksumList;  // list of result checksum of the files.  This is to analyze if the result were different.
32  
33      public TileAnalyzeCapture() {
34          numCalls = 0;
35          useAttribute = new HashMap();
36          checksumList = new ArrayList();
37      }
38  
39      public int getNumCalls() {
40          return numCalls;
41      }
42  
43      public void setNumCalls(int numCalls) {
44          this.numCalls = numCalls;
45      }
46  
47      public Map getUseAttribute() {
48          return useAttribute;
49      }
50  
51      public void setUseAttribute(Map useAttribute) {
52          this.useAttribute = useAttribute;
53      }
54  
55      public List getChecksumList() {
56          return checksumList;
57      }
58  
59      public void setChecksumList(List checksumList) {
60          this.checksumList = checksumList;
61      }
62  
63      /*
64          Method to modify data members.
65      */
66      public void incrementCapture() {
67          numCalls ++;
68      }
69  
70      public void addAttribute(String scope, String name) {
71          CacheAttribute attribute = new CacheAttribute(name, scope);
72          Integer hitCount = (Integer) useAttribute.get(attribute);
73          if (hitCount == null) {
74              hitCount = new Integer(1);
75          }
76  
77          useAttribute.put(attribute, hitCount);
78      }
79  
80      public void addChecksum(String checksum) {
81          checksumList.add(checksum);
82      }
83  }