The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
TemporalVariablesTable.cs
Go to the documentation of this file.
1 // -------------------------------------------------------------------------- //
3 // Project Stadyn //
4 // -------------------------------------------------------------------------- //
5 // File: TemporalVarsTable.cs //
6 // Author: Daniel Zapico Rodriguez - daniel.zapico.rodriguez@gmail.com //
7 // Description: //
8 // Implementation of a table of temporal variables. //
9 // -------------------------------------------------------------------------- //
10 // Create date: 24-09-2009 //
11 // Modification date: //
13 // COMENTAR CON PACO LA VIABILIDAD DE HACER LAS CONSULTAS E INSERCIONES CON EXCCEPCIONES
14 using System;
15 using System.Collections.Generic;
16 using System.Text;
17 
18 using ErrorManagement;
19 using AST;
20 
21 namespace CodeGeneration {
28 
29  #region Fields
30  private Dictionary<string, string> typesToId;
34 
38  private static TemporalVariablesTable instance;
39 
40 
41 
42  #endregion
43 
44  #region Properties
45 
46 
51  get {
52  if (instance == null)
53  instance = new TemporalVariablesTable();
54  return instance;
55  }
56  }
57 
58  #endregion
59 
60  #region Constructor
61  // </summary>
63 
64  this.typesToId = new Dictionary<string, string> ();
65  }
66  #endregion
67 
68  #region Insert()
69 
76  public void Insert(string type, string id) {
77  if (this.SearchId(type) == null)
78  this.typesToId.Add(type, id);
79  }
80 
81 
82  #endregion
83 
84  #region Search()
85 
91  public string SearchId(string type) {
92  if (this.typesToId.ContainsKey(type))
93  return this.typesToId[type];
94  return null;
95  }
96 
97 
98  #endregion
99 
100 #region Remove
101  public void Clear() {
105  this.typesToId.Clear();
106  }
107 
108 #endregion
109 
110  }
111 }
string SearchId(string type)
Searches the temporal variable.whose type is represented in type
Implementation of a table of variables. thist tables search for an id according to its string type re...
void Insert(string type, string id)
Insert a new temporal var. If the variable exists it. the new pair is not inserted ...
void Clear()
Deletes all the values in the table
static TemporalVariablesTable Instance
Gets the unique instance of TemporalVariablesTable