public void Add(object key, object val)
{
string name = (string)key;
if(this.Contains(key))
{
PrologVariableDictionaryEntry entry = GetEntry((string)key);
entry.Occurrences += 1;
entry.LastGoal = _currentGoalIndex;
entry.LastGoalArgument = _currentArgumentIndex;
}
else
{
PrologVariableDictionaryEntry variable = new PrologVariableDictionaryEntry(name, -1);
variable.Occurrences = 0;
variable.FirstGoal = _currentGoalIndex;
variable.IsReferenced = false;
variable.IsGlobal = false;
variable.Occurrences += 1;
variable.LastGoal = _currentGoalIndex;
variable.LastGoalArgument = _currentArgumentIndex;
variable.IsReferenced = false;
_items.Add(variable);
}
}