public static Tuple <Airspace, Sector> FindSector(string _controller, string _airspace, string _sector) { Controller ctlTemp = Find(_controller); if (ctlTemp != null) { OwnedAirspace owaTemp = ctlTemp.FindOwnedAirspace(_airspace); if (owaTemp != null) { Sector sctTemp = owaTemp.aspAirspace.FindSector(_sector); if (sctTemp != null) { Sector sctReturn = new Sector(sctTemp); if (owaTemp.intMinAlt > sctReturn.intMinAlt || sctReturn.intMinAlt == null) { sctReturn.intMinAlt = owaTemp.intMinAlt; } if (owaTemp.intMaxAlt < sctReturn.intMaxAlt || sctReturn.intMaxAlt == null) { sctReturn.intMaxAlt = owaTemp.intMaxAlt; } return(new Tuple <Airspace, Sector>(owaTemp.aspAirspace, sctReturn)); } } } return(null); }
private OwnedAirspace FindOwnedAirspace(string _id) { //Set bounds int intMidpoint; int intMin = 0; if (listOwned.Count > 0) { int intMax = listOwned.Count - 1; do { //Set midpoint intMidpoint = (intMin + intMax) / 2; //Find midpoint items OwnedAirspace owaCurrent = listOwned[intMidpoint]; //If current is search if (string.Compare(owaCurrent.aspAirspace.strID, _id) == 0) { return(owaCurrent); } //If current is before search else if (string.Compare(owaCurrent.aspAirspace.strID, _id) < 0) { intMin = intMidpoint + 1; } //If current is after search else if (string.Compare(owaCurrent.aspAirspace.strID, _id) > 0) { intMax = intMidpoint - 1; } } while (intMin <= intMax); } return(null); }
public void Add(OwnedAirspace _ownedairspace) { listOwned.Add(_ownedairspace); }
public void SortAirspace() { listOwned = OwnedAirspace.Sort(listOwned); }