How can I add a state sets view by script?

Hi, everyone,

Is anybody can help me, plese?

How can I add a new state sets view by script?
How can I control the state sets view which is not materstate?
How can I copy a state form a state sets view to a other one?

If anybody know, tell me please.