Extracted factory and base class from StateMachineBuilder

The StateMachineBuilder class did not follow the same design pattern as
the StateBuilder(Base|Factory) classes.  The factory and base class
functionality has now been moved to separate classes.
Converted from HashSet to LinkedHashSet

Using a LinkedHashSet should improve performance of iterating through
the set when the set is very large.  This also allows for the order of
the set to remain constant and behave like a LinkedList.