private static StateFinder GetFinder(AddressParseContainer container)
        {
            var splitter = new AddressSplitter(container);
            var finder   = new StateFinder(container);

            splitter.SplitAndClean();

            return(finder);
        }
예제 #2
0
파일: Program.cs 프로젝트: yavuzsyl/SOLID
        static void Main(string[] args)
        {
            var stateFinder = new StateFinder();

            try{
                Console.WriteLine(stateFinder.GetStateNameForZipCode(11));
                Console.WriteLine(stateFinder.GetStateNameForZipCode(9));
            } catch (InvalidOperationException exception) {
                Console.WriteLine(exception.Message);
            }
        }
예제 #3
0
        static void Main(string[] args)
        {
            var stateFinder = new StateFinder();

            try{
                Console.WriteLine(stateFinder.GetStateNameForZipCode(11));

                // This will now pass. However, it is still invalid for the United States.
                Console.WriteLine(stateFinder.GetStateNameForZipCode(9));
            } catch (InvalidOperationException exception) {
                Console.WriteLine(exception.Message);
            }
        }
예제 #4
0
        public void Start()
        {
            string fileName = ConfigurationManager.AppSettings["tweets"];

            string[]        stringTweets = File.ReadAllText(fileName).Split(new[] { Environment.NewLine }, StringSplitOptions.None);
            IList <Tweet>   tweets       = new List <Tweet>();
            IParser <Tweet> parser       = new TweetParser();

            foreach (string tweet in stringTweets)
            {
                tweets.Add(parser.Parse(tweet));
            }

            SentimentsParser.Parse(tweets, Context.Sentiments);

            StateFinder.Find(tweets, Context.StatesPolygons);

            Context.StatesSentiments = StatesEvaluator.Evaluate(tweets, Context.StatesPolygons.Keys);
        }
예제 #5
0
        static void Main(string[] args)
        {
            var stateFinder = new StateFinder();

            // For the United States
            try{
                var addressVerifier = new AddressVerifier();
                Console.WriteLine(stateFinder.GetStateNameForZipCode(11, addressVerifier));
                Console.WriteLine(stateFinder.GetStateNameForZipCode(9, addressVerifier));
            } catch (InvalidOperationException exception) {
                Console.WriteLine(exception.Message);
            }

            // For the Germany
            try{
                var addressVerifier = new GermanyAddressVerifier();
                Console.WriteLine(stateFinder.GetStateNameForZipCode(9, addressVerifier));
            } catch (InvalidOperationException exception) {
                Console.WriteLine(exception.Message);
            }
        }
예제 #6
0
 // Use this for initialization
 void Start()
 {
     state = GetComponent <StateFinder>();
     rb    = GetComponent <Rigidbody> ();
 }