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 = 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; PEQSinkInfoReport target = (PEQSinkInfoReport)targetFromThisObject; PEQSinkInfoReport output = new PEQSinkInfoReport(newID, newTimestamp, _key, _label); output._location = newLocation; output._elapsedTime = _elapsedTime; return output; } else return null; }
IInfoReport GeneratePEQSinkInfoReport(double elapsedTime, PEQMessageNotify notifyMessage) { PEQSinkInfoReport report = new PEQSinkInfoReport(_id.GetID(), _eventManager.CurrentClock, "PEQ_Sink", "PEQ Sink:"); report._elapsedTime = elapsedTime; report._numHops = notifyMessage._Data._NumHops; report._totalDistance = notifyMessage._Data._TotalDistance; report.Loc = this.Location; return report; }
/* / \ * // | \\ * / | \ * | */ 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; PEQSinkInfoReport target = (PEQSinkInfoReport)withTarget; PEQSinkInfoReport output = new PEQSinkInfoReport(newID, newTimestamp, _key, _label); output._location = newLocation; output._elapsedTime = _elapsedTime; return output; } else return null; }