another timeline optimization to avoid unneccessary file object creation when populating the chart from mactime

This commit is contained in:
adam-m 2013-06-17 16:25:45 -04:00
parent 4a242017e5
commit b65d810879

View File

@ -698,7 +698,7 @@ public class Timeline extends CallableSystemAction implements Presenter.Toolbar,
return month; return month;
} }
public void add(AbstractFile af, int month, int day) { public void add(long fileId, int month, int day) {
// see if this month is in the list // see if this month is in the list
MonthEpoch monthEpoch = null; MonthEpoch monthEpoch = null;
for (MonthEpoch me : months) { for (MonthEpoch me : months) {
@ -714,7 +714,7 @@ public class Timeline extends CallableSystemAction implements Presenter.Toolbar,
} }
// add the file the the MonthEpoch object // add the file the the MonthEpoch object
monthEpoch.add(af, day); monthEpoch.add(fileId, day);
} }
} }
@ -757,7 +757,7 @@ public class Timeline extends CallableSystemAction implements Presenter.Toolbar,
return de; return de;
} }
public void add(AbstractFile af, int day) { public void add(long fileId, int day) {
DayEpoch dayEpoch = null; DayEpoch dayEpoch = null;
for (DayEpoch de : days) { for (DayEpoch de : days) {
if (de.getDayInt() == day) { if (de.getDayInt() == day) {
@ -771,7 +771,7 @@ public class Timeline extends CallableSystemAction implements Presenter.Toolbar,
days.add(dayEpoch); days.add(dayEpoch);
} }
dayEpoch.add(af); dayEpoch.add(fileId);
} }
/** /**
@ -807,8 +807,8 @@ public class Timeline extends CallableSystemAction implements Presenter.Toolbar,
return fileIds.size(); return fileIds.size();
} }
public void add(AbstractFile af) { public void add(long fileId) {
fileIds.add(af.getId()); fileIds.add(fileId);
} }
List<Long> getEvents() { List<Long> getEvents() {
@ -901,16 +901,8 @@ public class Timeline extends CallableSystemAction implements Presenter.Toolbar,
prevYear = year; prevYear = year;
} }
// create and add the file
AbstractFile file;
try {
file = skCase.getAbstractFileById(ObjId);
} catch (TskCoreException ex) {
logger.log(Level.SEVERE, "Could not find a file with ID " + ObjId, ex);
continue;
}
if (ye != null) { if (ye != null) {
ye.add(file, month, day); ye.add(ObjId, month, day);
} }
} }