protected void Validate(NonTerminalState nonTerminalState) { this.ValidateBase((State)nonTerminalState); Invariant(nonTerminalState.Transitions != null && !nonTerminalState.Transitions.IsEmpty(), "nonTerminalState.Transitions must not be null or empty."); foreach (Transition transition in nonTerminalState.Transitions) { this.Validate(transition); } }
internal static State State(string typeName) { DesignByContract.Check.Require(!string.IsNullOrEmpty(typeName), string.Format(CommonStrings.XMustNotBeNullOrEmpty, "typeName")); State state = null; switch (typeName) { case "NON_TERMINAL_STATE": state = new NonTerminalState(); break; case "TERMINAL_STATE": state = new TerminalState(); break; default: throw new NotSupportedException("type not supported: " + typeName); } DesignByContract.Check.Ensure(state != null, "state must not be null."); return(state); }