Variable Redefinition

Variable Redefinition:
===

When variables are redefined in a new code block node, the node should go into an error state. To facilitate this, along with other conditions that derive from the same issue, the following commit is proposed.


Variable Definition Map:
---
To store the data with respect to the different defined variables and the nodes they have been defined in, a variable map was created that is stored in the Workspace. This map stores the defined variables along with the list of Guids of the Code Block Nodes that define that particular variable.

VariableDefinition Class:
---
This is a class that is used to store the variable definition map. It inherits from model base so that it may be recorded for undo/redo. It also has methods for saving and loading.


How It Works:
---
Whenever a code block nodes code (and hence variables it defines) changes, the table in the workspace is updated. If the variable was not yet defined, a new field is added to the map. Otherwise the GUID of the node is added to the end of the list related to that variable.

On re-validation, each required Code Block Node makes sure that the for each of its defined variables, the first GUID in the list of GUIDs mapped to the defined variable by the Map is the same as its own. If not, it is not the CBN that defined it and it is set to an erroneous state.

During Undo/Redo or Load/Save, the map is serialized as well and when all the nodes and map have been de-serialized, the nodes are re-validated.


An example : 
![img_20131218_120759](https://f.cloud.github.com/assets/5274938/1770722/87883768-679a-11e3-89ec-b6503a9180a1.jpg)

Here the variable a has three definitions, the order of defining nodes being : 12345, abcde and 98xyz. This was because a was defined first in 12345, then in abcde and finally in 98xyz. Hence two nodes will show an error.