DfsObjDatabase: Add lazy last modified method to PackList

Change-Id: Id045f162fa584ea14da29a9df58a42c53a78dc15
This commit is contained in:
Dave Borowitz 2016-07-19 13:05:27 -04:00
parent e790ec3fb1
commit ecb2aa0503
1 changed files with 14 additions and 0 deletions

View File

@ -495,10 +495,24 @@ public static abstract class PackList {
/** All known packs, sorted. */
public final DfsPackFile[] packs;
private long lastModified = -1;
PackList(DfsPackFile[] packs) {
this.packs = packs;
}
/** @return last modified time of all packs, in milliseconds. */
public long getLastModified() {
if (lastModified < 0) {
long max = 0;
for (DfsPackFile pack : packs) {
max = Math.max(max, pack.getPackDescription().getLastModified());
}
lastModified = max;
}
return lastModified;
}
abstract boolean dirty();
/**