Move StateNode class to a separate file.

Makes the package compatible with PSR-0.