public List <MWSelection> checkForPotentialCurveData()
        {
            List <MWSelection> returnSelectionList = new List <MWSelection>();
            //find any potential curve data with the use of the curve keyword
            int i = 0;

            do
            {
                MWSelection nextCurve = findNextCurve(i);

                if (nextCurve.getEndIndex() == -1)
                {
                    //no curve info found
                    i = theString.Length;
                    //loop will exit
                }
                else
                {
                    returnSelectionList.Add(nextCurve);
                    i = nextCurve.getEndIndex();
                }
            } while (i < theString.Length);



            return(returnSelectionList);
        }
        public MWSelection findNextString(string theString, int startingIndex, string searchString)
        {
            MWSelection selectionObject = new MWSelection();
            int         i = startingIndex;

            if (startingIndex == -1)
            {
                i = 0;
            }
            while (i < (theString.Length - searchString.Length + 1) && selectionObject.getEndIndex() < 0)
            {
                if (theString[i] == searchString[0]) //possbile hit
                {
                    //test if the word matches
                    string testword = theString.Substring(i, searchString.Length);
                    if (testword == searchString)
                    {
                        //we have a matching word
                        selectionObject.setStartIndex(i);
                        selectionObject.setEndIndex(i + searchString.Length - 1);
                    }
                }
                ++i;
            }//end while

            return(selectionObject);
        }
        public MWSelection findPOC(int startingIndex)
        {
            string[] stringArray = new string[] { "COMMENCING", "Commencing" };

            MWSelection returnSelectionObject = new MWSelection();

            returnSelectionObject = findNextGeneral(stringArray, startingIndex);

            return(returnSelectionObject);
        }
        public MWSelection findPOB(int startingIndex)
        {
            string[] stringArray = new string[] { "REAL POINT OF BEGINNING", "POINT OF BEGINNING", "Real Point of Beginning", "Point of Beginning" };

            MWSelection returnSelectionObject = new MWSelection();

            returnSelectionObject = findNextGeneral(stringArray, startingIndex);

            return(returnSelectionObject);
        }
        public MWSelection findEndDirection(int startingIndex, string aCallString = "")
        {
            string[] stringArray = new string[] { "East", "EAST", "West", "WEST" };

            MWSelection returnSelectionObject = new MWSelection();

            returnSelectionObject = findNextGeneral(stringArray, startingIndex, aCallString);

            return(returnSelectionObject);
        }
        public MWSelection findStartDirection(int startingIndex, string aCallString = "")
        {
            string[] stringArray = new string[] { "North", "NORTH", "South", "SOUTH" };

            MWSelection returnSelectionObject = new MWSelection();

            returnSelectionObject = findNextGeneral(stringArray, startingIndex, aCallString);

            return(returnSelectionObject);
        }
        public MWSelection findNextCurve(int startingIndex, string aCallString = "")
        {
            string[] stringArray = new string[] { "Curve", "CURVE", "curve", "Arc", "ARC" };

            MWSelection returnSelectionObject = new MWSelection();

            returnSelectionObject = findNextGeneral(stringArray, startingIndex, aCallString);

            return(returnSelectionObject);
        }
        public MWSelection findFeet(int startingIndex, string aCallString = "")
        {
            string[] stringArray = new string[] { "Feet", "FEET", "feet", "FT", "FT.", "Ft", "Ft." };

            MWSelection returnSelectionObject = new MWSelection();

            returnSelectionObject = findNextGeneral(stringArray, startingIndex, aCallString);

            return(returnSelectionObject);
        }
        public MWSelection findRight(int startingIndex, string aCallString = "")
        {
            string[] stringArray = new string[] { "Right", "RIGHT", "right", "rt.", "RT.", "Rt." };

            MWSelection returnSelectionObject = new MWSelection();

            returnSelectionObject = findNextGeneral(stringArray, startingIndex, aCallString);

            return(returnSelectionObject);
        }
        public MWSelection findRadius(int startingIndex, string aCallString = "")
        {
            string[] stringArray = new string[] { "Radius", "RADIUS", "radius", "rad.", "rad" };

            MWSelection returnSelectionObject = new MWSelection();

            returnSelectionObject = findNextGeneral(stringArray, startingIndex, aCallString);

            return(returnSelectionObject);
        }
        public MWSelection findLeft(int startingIndex, string aCallString = "")
        {
            string[] stringArray = new string[] { "Left", "LEFT", "left", "lt.", "LT.", "Lt." };

            MWSelection returnSelectionObject = new MWSelection();

            returnSelectionObject = findNextGeneral(stringArray, startingIndex, aCallString);

            return(returnSelectionObject);
        }
        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 bool findCurveKeyword(int startingIndex, string aCallString = "")
        {
            bool returnBool = false;

            string[]    stringArray     = new string[] { "Curve", "CURVE", "curve" };
            MWSelection returnSelection = new MWSelection();

            returnSelection = findNextGeneral(stringArray, startingIndex, aCallString);

            if (returnSelection.getStartIndex() != -1)
            {
                returnBool = true;
            }
            return(returnBool);
        }
        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 CurveLeftRightCategory findRightLeftKeyword(string aCallString)
        {
            CurveLeftRightCategory returnCat = CurveLeftRightCategory.NotFound;

            MWSelection selectionObject = findRight(0, aCallString);

            if (selectionObject.getStartIndex() > -1)
            {
                returnCat = CurveLeftRightCategory.Right;
            }

            if (returnCat != CurveLeftRightCategory.Right)
            {
                selectionObject = findLeft(0, aCallString);
                if (selectionObject.getStartIndex() > -1)
                {
                    returnCat = CurveLeftRightCategory.Left;
                }
            }

            return(returnCat);
        }
        public MWSelection findNextPotentialCall(int startingIndex)
        {
            MWSelection returnSelection = new MWSelection();

            MWSelection nextStart = findStartDirection(startingIndex);
            MWSelection nextEnd   = findEndDirection(startingIndex);
            MWSelection nextFeet  = findFeet(startingIndex);

            int  lenghthOfBearing = nextEnd.getEndIndex() - nextStart.getEndIndex();
            bool potentialBearing = false;

            if (lenghthOfBearing >= 10 && lenghthOfBearing <= 25)
            {
                potentialBearing = true;
            }

            int  lengthOfDistance  = nextFeet.getEndIndex() - nextEnd.getEndIndex();
            bool potentialDistance = false;

            if (lengthOfDistance >= 8 && lengthOfDistance <= 200)
            {
                potentialDistance = true;
            }

            if (potentialBearing == false || potentialDistance == false)
            {
                returnSelection.setEndIndex(-1);
                returnSelection.setStartIndex(-1);
            }
            else
            {
                returnSelection.setStartIndex(nextStart.getStartIndex());
                returnSelection.setEndIndex(nextFeet.getEndIndex() + 1);
            }
            //if it is a potential call then it will return the position
            //if it does not look like the right lengths it will return -1 and -1
            return(returnSelection);
        }
        public MWSelection findNextGeneral(string[] stringArray, int startingIndex, string aString = "")
        {
            string stringToSearch = theString; //thestring is a property of the class

            if (aString.Length != 0)
            {
                stringToSearch = aString;
            }

            MWSelection returnSelectionObject = new MWSelection();

            MWSelection[] selectionObjectArray = new MWSelection[stringArray.Length];

            for (int i = 0; i < stringArray.Length; ++i)
            {
                MWSelection tempSelection = new MWSelection();
                tempSelection = findNextString(stringToSearch, startingIndex, stringArray[i]);
                selectionObjectArray.SetValue(tempSelection, i);
            }

            int firstStart = 0;

            returnSelectionObject = selectionObjectArray[0];

            for (int j = 0; j < stringArray.Length; ++j)
            {
                if (selectionObjectArray[j].getStartIndex() >= 0 &&
                    (selectionObjectArray[j].getStartIndex() < firstStart || firstStart == 0))
                {
                    firstStart            = selectionObjectArray[j].getStartIndex();
                    returnSelectionObject = selectionObjectArray[j];
                }
            }


            return(returnSelectionObject);
        }
        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());
        }