1 package tim.prune.function.cache;
4 * Class to hold the information for a single table row.
5 * Used to describe a tileset or for a single zoom level of a tileset.
9 private int _zoom = -1;
10 private int _minZoom = -1, _maxZoom = -1;
11 private int _numTiles = 0;
12 private long _totalSize = 0L;
13 private boolean _unexpected = false;
18 * @param inZoom zoom level
20 public void setZoom(int inZoom) {
25 * Add a zoom level and adjust max/min
26 * @param inZoom zoom level
28 public void addZoom(int inZoom)
30 if (_minZoom < 0 || _minZoom > inZoom)
32 if (_maxZoom < inZoom)
37 * @return the zoom level
39 public int getZoom() {
44 * @return the zoom range as a string
46 public String getZoomRange()
48 if (_minZoom < 0 && _maxZoom < 0) return "";
49 if (_minZoom == _maxZoom || _maxZoom < 0) return "" + _minZoom;
50 if (_minZoom < 0) return "" + _maxZoom;
51 return "" + _minZoom + " - " + _maxZoom;
55 * Add a single tile of the given size
56 * @param inSize size in bytes
58 public void addTile(long inSize) {
64 * @param inNumTiles number of tiles to add
65 * @param inSize total size of the tiles in bytes
67 public void addTiles(int inNumTiles, long inSize)
69 _numTiles += inNumTiles;
74 * @return the total number of tiles found
76 public int getNumTiles() {
81 * @return the total size of the tiles in bytes
83 public long getTotalSize() {
88 * Mark that an unexpected file or directory was found
89 * TODO: Is this needed?
91 public void foundUnexpected() {
96 * @return true if any unexpected files or directories were found
98 public boolean wasUnexpected() {
103 * Add the given RowInfo object to this one
104 * @param inOther other row object
106 public void addRow(RowInfo inOther)
110 _numTiles += inOther._numTiles;
111 _totalSize += inOther._totalSize;
114 if (inOther._minZoom > 0)
115 addZoom(inOther._minZoom);
116 if (inOther._maxZoom > 0)
117 addZoom(inOther._maxZoom);
118 if (inOther._zoom > 0)
119 addZoom(inOther._zoom);
120 _unexpected = _unexpected || inOther._unexpected;