private StreamWriter processInfoReport(IInfoReport report, int runID)
 {
     StreamWriter stream = null;
     return processInfoReport(report, runID, stream);
 }
 private StreamWriter processInfoReport(IInfoReport report, bool timeForward)
 {
     return processInfoReport(report); // for now...
 }
        private StreamWriter processInfoReport(IInfoReport report, int runID, StreamWriter stream)
        {
            IInfoReport infoReport = (IInfoReport)report;
            String line;
            if (!_tableIO.TryGetValue(infoReport.Key, out stream))
            {
                string filename = text_IOFolder.Text + "\\"
                    + text_IOFileTag.Text + "_" + infoReport.Key + ".csv";

                if (filename.IndexOfAny(System.IO.Path.GetInvalidPathChars()) > -1)
                    return null;

                stream = new StreamWriter(filename);

                _tableIO.Add(infoReport.Key, stream);
                line = "runID, " + infoReport.CSVHeader;
                stream.WriteLine(line);
            }

            if (!infoReport.IsWritten)
            {
                line = runID.ToString() + ", " + infoReport.ToCSV();
                stream.WriteLine(line);
                infoReport.IsWritten = true;
            }
            return stream;
        }
        public IInfoReport Subtract(IInfoReport targetFromThisObject)
        {
            // Probably will be unused for this report type.
            if (targetFromThisObject is PEQAggregateInfoReport)
            {
                int newID;
                double newTimestamp;
                ILocation newLocation;
                bool sameNode = false;

                if (targetFromThisObject.ID == _id)
                {
                    sameNode = true;
                    newID = _id;
                    newLocation = _location;
                }
                else
                {
                    sameNode = false;
                    newID = int.MaxValue;
                    newLocation = null;
                }

                if (targetFromThisObject.Time > _timestamp)
                    newTimestamp = targetFromThisObject.Time;
                else newTimestamp = _timestamp;

                PEQAggregateInfoReport target = (PEQAggregateInfoReport)targetFromThisObject;
                PEQAggregateInfoReport output = new PEQAggregateInfoReport(newTimestamp,
                    _key, _label);
                output._location = newLocation;
                output._numSearches = this._numSearches - target._numSearches;
                return output;
            }
            else return null;
        }
 private StreamWriter processInfoReport(IInfoReport report)
 {
     return processInfoReport(report, 0);
 }
 public IInfoReport Subtract(IInfoReport targetFromThisObject)
 {
     return null;
 }
        /*       / \
         *     // | \\
         *    /   |   \
         *        |           */
        public IInfoReport Add(IInfoReport withTarget)
        {
            if (withTarget is PEQAggregateInfoReport)
            {
                int newID;
                double newTimestamp;
                ILocation newLocation;
                bool sameNode;
                if (withTarget.ID == _id)
                {
                    sameNode = true;
                    newID = _id;
                    newLocation = _location;
                }
                else
                {
                    sameNode = false;
                    newID = int.MaxValue;
                    newLocation = null;
                }

                if (withTarget.Time > _timestamp)
                    newTimestamp = withTarget.Time;
                else newTimestamp = _timestamp;

                PEQAggregateInfoReport target = (PEQAggregateInfoReport)withTarget;
                PEQAggregateInfoReport output = new PEQAggregateInfoReport(newTimestamp,
                    _key, _label);
                output._location = newLocation;
                output._numSearches = this._numSearches + target._numSearches;
                return output;
            }
            else return null;
        }
        public IInfoReport Subtract(IInfoReport targetFromThisObject)
        {
            // Value - targetFromThisObject.Value
            int newID;
            double newTimestamp;
            ILocation newLocation;
            bool sameNode;
            if (targetFromThisObject.ID == _id)
            {
                sameNode = true;
                newID = _id;
                newLocation = _location;
            }
            else
            {
                sameNode = false;
                newID = int.MaxValue;
                newLocation = null;
            }

            if (targetFromThisObject.Time > _timestamp)
                newTimestamp = targetFromThisObject.Time;
            else newTimestamp = _timestamp;

            if (targetFromThisObject is IntInfoReport)
            {
                IntInfoReport target = (IntInfoReport)targetFromThisObject;
                IntInfoReport output = new IntInfoReport(newID, newTimestamp,
                    _key, _label, Value - target.Value);
                output._location = newLocation;
                return output;
            }
            else return null;
        }
 /*       / \
  *     // | \\
  *    /   |   \
  *        |           */
 public IInfoReport Add(IInfoReport withTarget)
 {
     return null;
 }
        /*       / \
         *     // | \\
         *    /   |   \
         *        |           */
        public IInfoReport Add(IInfoReport withTarget)
        {
            int newID;
            double newTimestamp;
            ILocation newLocation;
            bool sameNode;
            if (withTarget.ID == _id)
            {
                sameNode = true;
                newID = _id;
                newLocation = _location;
            }
            else
            {
                sameNode = false;
                newID = int.MaxValue;
                newLocation = null;
            }

            if (withTarget.Time > _timestamp)
                newTimestamp = withTarget.Time;
            else newTimestamp = _timestamp;

            if (withTarget is IntInfoReport)
            {
                IntInfoReport target = (IntInfoReport)withTarget;
                IntInfoReport output = new IntInfoReport(newID, newTimestamp,
                    _key, _label, Value + target.Value);
                output._location = newLocation;
                return output;
            }
            else return null;
        }
        public IInfoReport Subtract(IInfoReport targetFromThisObject)
        {
            // Probably will be unused for this report type.
            if (targetFromThisObject is PEQNodeInfoReport)
            {
                int newID;
                double newTimestamp;
                ILocation newLocation;
                bool sameNode;
                if (targetFromThisObject.ID == _id)
                {
                    sameNode = true;
                    newID = _id;
                    newLocation = _location;
                }
                else
                {
                    sameNode = false;
                    newID = int.MaxValue;
                    newLocation = null;
                }

                if (targetFromThisObject.Time > _timestamp)
                    newTimestamp = targetFromThisObject.Time;
                else newTimestamp = _timestamp;

                PEQNodeInfoReport target = (PEQNodeInfoReport)targetFromThisObject;
                PEQNodeInfoReport output = new PEQNodeInfoReport(newID, newTimestamp,
                    _key, _label);
                output._location = newLocation;
                output._sentHellos = _sentHellos - target._sentHellos;
                output._sentBuildTrees = _sentBuildTrees - target._sentBuildTrees;
                output._sentSubscribes = _sentSubscribes - target._sentSubscribes;
                output._sentNotifys = _sentNotifys - target._sentNotifys;
                output._sentACKs = _sentACKs - target._sentACKs;
                output._sentSearches = _sentSearches - target._sentSearches;
                output._sentResponses = _sentResponses - target._sentResponses;
                output._rcvdHellos = _rcvdHellos - target._rcvdHellos;
                output._rcvdBuildTrees = _rcvdBuildTrees - target._rcvdBuildTrees;
                output._rcvdSubscribes = _rcvdSubscribes - target._rcvdSubscribes;
                output._rcvdNotifys = _rcvdNotifys - target._rcvdNotifys;
                output._rcvdACKs = _rcvdACKs - target._rcvdACKs;
                output._rcvdSearches = _rcvdSearches - target._rcvdSearches;
                output._rcvdResponses = _rcvdResponses - target._rcvdResponses;
                output._procApplications = _procApplications - target._procApplications;
                output._Collisions = _Collisions - target._Collisions;
                return output;
            }
            else return null;
        }
        /*       / \
         *     // | \\
         *    /   |   \
         *        |           */
        public IInfoReport Add(IInfoReport withTarget)
        {
            if (withTarget is PEQNodeInfoReport)
            {
                int newID;
                double newTimestamp;
                ILocation newLocation;
                bool sameNode;
                if (withTarget.ID == _id)
                {
                    sameNode = true;
                    newID = _id;
                    newLocation = _location;
                }
                else
                {
                    sameNode = false;
                    newID = int.MaxValue;
                    newLocation = null;
                }

                if (withTarget.Time > _timestamp)
                    newTimestamp = withTarget.Time;
                else newTimestamp = _timestamp;

                PEQNodeInfoReport target = (PEQNodeInfoReport)withTarget;
                PEQNodeInfoReport output = new PEQNodeInfoReport(newID, newTimestamp,
                    _key, _label);
                output._location = newLocation;
                output._sentHellos = _sentHellos + target._sentHellos;
                output._sentBuildTrees = _sentBuildTrees + target._sentBuildTrees;
                output._sentSubscribes = _sentSubscribes + target._sentSubscribes;
                output._sentNotifys = _sentNotifys + target._sentNotifys;
                output._sentACKs = _sentACKs + target._sentACKs;
                output._sentSearches = _sentSearches + target._sentSearches;
                output._sentResponses = _sentResponses + target._sentResponses;
                output._rcvdHellos = _rcvdHellos + target._rcvdHellos;
                output._rcvdBuildTrees = _rcvdBuildTrees + target._rcvdBuildTrees;
                output._rcvdSubscribes = _rcvdSubscribes + target._rcvdSubscribes;
                output._rcvdNotifys = _rcvdNotifys + target._rcvdNotifys;
                output._rcvdACKs = _rcvdACKs + target._rcvdACKs;
                output._rcvdSearches = _rcvdSearches + target._rcvdSearches;
                output._rcvdResponses = _rcvdResponses + target._rcvdResponses;
                output._procApplications = _procApplications + target._procApplications;
                output._Collisions = _Collisions + target._Collisions;
                return output;
            }
            else return null;
        }
        public IInfoReport Subtract(IInfoReport targetFromThisObject)
        {
            // Probably will be unused for this report type.
            if (targetFromThisObject is PEQDataInfoReport)
            {
                PEQDataInfoReport target = (PEQDataInfoReport)targetFromThisObject;
                if (target._DataID != _DataID)
                    return null;

                int newID;
                double newTimestamp;
                ILocation newLocation;
                bool sameNode = false;

                if (targetFromThisObject.ID == _id)
                {
                    sameNode = true;
                    newID = _id;
                    newLocation = _location;
                }
                else
                {
                    sameNode = false;
                    newID = int.MaxValue;
                    newLocation = null;
                }

                if (targetFromThisObject.Time > _timestamp)
                    newTimestamp = targetFromThisObject.Time;
                else newTimestamp = _timestamp;

                PEQDataInfoReport output = new PEQDataInfoReport(newID, newTimestamp,
                    _key, _label);
                output._location = newLocation;
                output._DataID = _DataID;
                output._Received = _Received - target._Received;
                output._Sent = _Sent - target._Sent;
                return output;
            }
            else return null;
        }
        /*       / \
         *     // | \\
         *    /   |   \
         *        |           */
        public IInfoReport Add(IInfoReport withTarget)
        {
            if (withTarget is PEQDataInfoReport)
            {
                PEQDataInfoReport target = (PEQDataInfoReport)withTarget;
                if (target._DataID != _DataID)
                    return null;

                int newID;
                double newTimestamp;
                ILocation newLocation;
                bool sameNode;
                if (withTarget.ID == _id)
                {
                    sameNode = true;
                    newID = _id;
                    newLocation = _location;
                }
                else
                {
                    sameNode = false;
                    newID = int.MaxValue;
                    newLocation = null;
                }

                if (withTarget.Time < _timestamp)
                    newTimestamp = withTarget.Time;
                else newTimestamp = _timestamp;

                PEQDataInfoReport output = new PEQDataInfoReport(newID, newTimestamp,
                    _key, _label);
                output._location = newLocation;
                output._DataID = _DataID;
                output._Received = _Received + target._Received;
                output._Sent = _Sent + target._Sent;
                return output;
            }
            else return null;
        }