public MWNumberSelection extractMinutes(int prevIndex, string aCallString = "") { MWNumberSelection returnVal = new MWNumberSelection(); //find the next number after the north south keyword returnVal = extractNextNumberVal(prevIndex, aCallString); return(returnVal); }
public MWNumberSelection extractLength(int EndDirectionIndex, string aCallString = "") { MWNumberSelection returnVal = new MWNumberSelection(); //find the feet keyword after the last end direction letter MWSelection feetLocation = findFeet(EndDirectionIndex, aCallString); //find the next number after the north south keyword returnVal = extractPreviousNumberVal(feetLocation.getStartIndex(), aCallString); return(returnVal); }
public MWNumberSelection extractNextNumberVal(int prevIndex, string aCallString) { MWNumberSelection returnVal = new MWNumberSelection(); //find the first digit int n = 0; bool numberEnded = false; int i = prevIndex + 1; int foundStartIndex = -1; int foundEndingIndex = -1; do { //find the first number if (int.TryParse(Convert.ToString(aCallString[i]), out n) == true) { //we have the first number, we need to add it to the string foundStartIndex = i; do { if (int.TryParse(Convert.ToString(aCallString[i + 1]), out n) == true || aCallString[i + 1] == '.') { ++i; } else { numberEnded = true; foundEndingIndex = i; } } while (numberEnded == false && i < aCallString.Length); } ++i; } while (numberEnded == false && i < aCallString.Length); string foundValue = aCallString.Substring(foundStartIndex, (foundEndingIndex + 1) - foundStartIndex); returnVal.setNumberValue(Convert.ToDouble(foundValue)); returnVal.setNumberValue(Convert.ToDouble(foundValue)); returnVal.setStartIndex(foundStartIndex); returnVal.setEndIndex(foundEndingIndex); return(returnVal); }
public double extractRadius(string aCallString) { double returnVal = -1; MWNumberSelection aNumberSelection = new MWNumberSelection(); MWSelection radiusSelection = new MWSelection(); radiusSelection = findRadius(0, aCallString); if (radiusSelection.getStartIndex() > -1) { aNumberSelection = extractNextNumberVal(radiusSelection.getEndIndex() + 1, aCallString); } returnVal = aNumberSelection.getNumberValue(); return(returnVal); }
public DeconstructedCallString(string aCallString, int _gStartindex, int _gEndIndex) { LegalDescriptionStringUtility util = new LegalDescriptionStringUtility(aCallString); theString = aCallString; globalStart = _gStartindex; globalEnd = _gEndIndex; //is is a curve and is it left or right if (util.findCurveKeyword(0, theString) == false) { curveLeftRight = CurveLeftRightCategory.NA; } else { curveLeftRight = util.findRightLeftKeyword(theString); } Console.WriteLine("Stop for Test"); if (curveLeftRight.Value == CurveLeftRightCategory.Left.Value || curveLeftRight.Value == CurveLeftRightCategory.Right.Value) { //find the radius radius = util.extractRadius(theString); } //set north or south MWSelection NSlocation = util.findStartDirection(0, theString); int begIndex = NSlocation.getStartIndex(); if (theString[begIndex] == 'N' || theString[begIndex] == 'n') { startDirection = StartDirectionCategory.North; } else { startDirection = StartDirectionCategory.South; } //set east or west MWSelection EWlocation = util.findEndDirection(0, theString); begIndex = EWlocation.getStartIndex(); if (theString[begIndex] == 'E' || theString[begIndex] == 'e') { endDirection = EndDirectionCategory.East; } else { endDirection = EndDirectionCategory.West; } //Find the degrees and its location in the string MWNumberSelection degreesSelection = util.extractDegrees(NSlocation.getEndIndex(), theString); degrees = Convert.ToInt32(degreesSelection.getNumberValue()); //find the minutes MWNumberSelection minutesSelection = util.extractMinutes(degreesSelection.getEndIndex(), theString); this.minutes = Convert.ToInt32(minutesSelection.getNumberValue()); //find the seconds MWNumberSelection secondsSelection = util.extractSeconds(minutesSelection.getEndIndex(), theString); //three might not be any seconds if (secondsSelection.getEndIndex() < EWlocation.getStartIndex()) { this.seconds = Convert.ToInt32(secondsSelection.getNumberValue()); } else { this.seconds = 0; } //find the length //find the seconds MWNumberSelection lengthSelection = util.extractLength(EWlocation.getEndIndex(), theString); this.length = Convert.ToDouble(lengthSelection.getNumberValue()); }