Guest User

Untitled

a guest
Oct 23rd, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. private Type behaviour;
  2. private string name;
  3.  
  4. // each of the states needs to know where to go
  5. Dictionary<ASymbol, AState> transition;
  6.  
  7. // property
  8. // - equivalent to get/set methods
  9. public string Name {
  10. get {
  11. return name;
  12. }
  13. }
  14.  
  15. public Type Behaviour{
  16.  
  17. get{
  18. return behaviour;
  19. }
  20. }
  21.  
  22. public AState(string name, Type behaviour){
  23. this.name = name;
  24. this.behaviour = behaviour;
  25. transition = new Dictionary<ASymbol, AState> ();
  26. }
  27.  
  28. public void AddTransition(ASymbol key, AState value){
  29. transition.Add (key, value);
  30. }
  31.  
  32. public AState ApplySymbol(ASymbol key){
  33.  
  34. if(transition.ContainsKey(key))
  35. return transition[key];
  36.  
  37. return this;
  38. }
  39.  
  40. private string name;
  41.  
  42. public string Name{
  43. get{
  44. return name;
  45. }
  46. }
  47.  
  48. public ASymbol(string name){
  49.  
  50. this.name = name;
  51. }
Add Comment
Please, Sign In to add comment