//The specific types have stricter constructors than the parent type. //And SO says that that is okay. //https://stackoverflow.com/questions/5490824/should-constructors-comply-with-the-liskov-substitution-principle public Token(string word, bool iAmAPrepositionChain = false) { if (word == null) { throw new ArgumentNullException("word"); } if (word.EndCheck(" ") && word != " ") { throw new InvalidOperationException("Untrimmed word."); } if (!iAmAPrepositionChain) { if (String.IsNullOrWhiteSpace(word)) { throw new ArgumentNullException("word", "Token cannot be null or white space"); } if (word.ContainsCheck(" ") && !TaggedWord.CheckIsTagWord(word)) { throw new ArgumentNullException("word", "Token can't contain white space-- must use *, - or other punctuation to join words into a single token : " + word); } } if (word.ContainsCheck("\n")) { throw new ArgumentNullException("word", "Token cannot contain white space-- must use *, - or other punctuation to join words into a single token : " + word); } if (word.ContainsCheck("\t")) { throw new ArgumentNullException("word", "Token cannot contain white space-- must use *, - or other punctuation to join words into a single token : " + word); } this.word = word; }