public void AddEventTest() { // Ensure there are four elements before starting Assert.AreEqual(4, collection.Count); // Add a new coordiante Drop drop = new Drop(); drop.Coordinate = new Coordinate(0,0,0); collection.Add(drop); // Test to ensure the count has gone up. Assert.AreEqual(5, collection.Count); }
/// <summary> /// This method returns the type of event as a String. /// </summary> /// <returns>Object type as a String</returns> public new String ToString() { // Switch based upon the three types of events switch (GetType().Name) { case "Drop": Drop d = (Drop)this; return(d.ToString()); case "Fail": Fail f = (Fail)this; return(f.ToString()); case "Success": Success s = (Success)this; return(s.ToString()); default: return(null); } }
private EventCollection GenerateCluster(double latlower, double latupper, double longlower, double longupper, int size) { // Initalise a new EventCollection EventCollection collection = new EventCollection(); // Initalise a new Random number generator Random random = new Random(); // Create size number of Coordinates for (int i = 0; i < size; i++) { // Generate a Longitude double longitude = random.NextDouble() * (longupper - longlower) + longlower; // Generate a Latitude double latitude = random.NextDouble() * (latupper - latlower) + latlower; // Setup a Test Event - it doesn't matter if its a drop, failure or success Drop evt = new Drop(); evt.Coordinate = new Coordinate(longitude, latitude); // Add to the collection collection.Add(evt); } // return the collection of events return collection; }
public void Initalise() { // Initialise an EventCollection collection = new EventCollection(); // Add four Events in the shape of a square Drop drop1 = new Drop(); drop1.Coordinate = new Coordinate(10, 10, 0); collection.Add(drop1); Drop drop2 = new Drop(); drop2.Coordinate = new Coordinate(10, 20, 0); collection.Add(drop2); Fail fail1 = new Fail(); fail1.Coordinate = new Coordinate(20, 10, 0); collection.Add(fail1); Fail fail2 = new Fail(); fail2.Coordinate = new Coordinate(20, 20, 0); collection.Add(fail2); }
/// <summary> /// This method will return an event collection of events from the given KML /// file in the constructor of this object. /// </summary> /// <returns>A collection of events</returns> public EventCollection GetCallLogs() { EventCollection calls = new EventCollection(); while (reader.Read()) { // Get the Coordinate Coordinate coordinate = ReadCoordinate(); // Move to the ExtendedData Space reader.ReadToNextSibling("ExtendedData"); //Get the additional data elements String device = GetSimpleData("device"); String pin = GetSimpleData("pin"); String timestamp = GetSimpleData("timestamp"); String reference = GetSimpleData("reference"); String type = GetSimpleData("type"); String start_rat = GetSimpleData("start_rat"); String end_rat = GetSimpleData("end_rat"); String start_mix_band = GetSimpleData("start_mix_band"); String end_mix_band = GetSimpleData("end_mix_band"); String start_rrc_state = GetSimpleData("start_rrc_state"); // Create a new Call Log Object Event callLog = null; // Force the call log to be a type switch (type) { case "Call Drop": callLog = new Drop(); break; case "Setup Failure": callLog = new Fail(); break; case "Call Success": callLog = new Success(); break; default: break; } // Add additional attributes & add to the list if (callLog != null) { callLog.Device = device; callLog.Pin = pin; callLog.Timestamp = DateTime.Parse(timestamp); callLog.Reference = Boolean.Parse(reference); callLog.StartRat = start_rat; callLog.EndRat = end_rat; callLog.StartMixBand = start_mix_band; callLog.EndMixBand = end_mix_band; callLog.StartRRCState = start_rrc_state; callLog.Coordinate = coordinate; calls.Add(callLog); } } return calls; }
public void UpdateCentroidTest() { // Setup a new Collection EventCollection col = new EventCollection(); // Check the centroid has been initalised Assert.AreEqual(0, col.Centroid.Latitude); Assert.AreEqual(0, col.Centroid.Latitude); Assert.AreEqual(0, col.Centroid.Altitude); // Add four Events in the shape of a square Drop drop1 = new Drop(); drop1.Coordinate = new Coordinate(10, 10, 0); col.Add(drop1); Drop drop2 = new Drop(); drop2.Coordinate = new Coordinate(10, 20, 0); col.Add(drop2); Fail fail1 = new Fail(); fail1.Coordinate = new Coordinate(20, 10, 0); col.Add(fail1); Fail fail2 = new Fail(); fail2.Coordinate = new Coordinate(20, 20, 0); col.Add(fail2); // Check the centroid has been updated Assert.AreEqual(15, col.Centroid.Longitude); Assert.AreEqual(15, col.Centroid.Latitude); Assert.AreEqual(0, col.Centroid.Altitude); }