+
+ /**
+ * @param inIndex index number, starting from zero
+ * @return source info object
+ */
+ public SourceInfo getSource(int inIndex)
+ {
+ return _sources.get(inIndex);
+ }
+
+ /**
+ * Get the SourceInfo object (if any) for the given point
+ * @param inPoint point object
+ * @return SourceInfo object if there is one, otherwise null
+ */
+ public SourceInfo getSourceForPoint(DataPoint inPoint)
+ {
+ for (SourceInfo source : _sources)
+ {
+ if (source.getIndex(inPoint) >= 0) {
+ return source;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @return the info about the last file loaded, if any
+ */
+ public SourceInfo getLastFileInfo()
+ {
+ if (getNumFiles() == 0)
+ {
+ return null;
+ }
+ return getSource(getNumFiles()-1);
+ }
+
+ /**
+ * @return the most recent file title loaded, if any
+ */
+ public String getLastFileTitle()
+ {
+ final int numFiles = getNumFiles();
+ if (numFiles == 0)
+ {
+ return null;
+ }
+ for (int i=(numFiles-1); i>=0; i--)
+ {
+ SourceInfo info = getSource(i);
+ if (info != null)
+ {
+ String title = info.getFileTitle();
+ if (title != null && !title.equals(""))
+ {
+ return title;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Clone contents of file info
+ */
+ @SuppressWarnings("unchecked")
+ public FileInfo clone()
+ {
+ // copy source list
+ ArrayList<SourceInfo> copy = (ArrayList<SourceInfo>) _sources.clone();
+ return new FileInfo(copy);
+ }