/* private int p; private string p_2; private SElementType sElementType; private string p_3; */ #endregion NULL #region DEFINE public void Link(SToken tokenParent, SToken tokenBefore, SToken tokenAfter, List<SToken> tokenChilds) { TokenParent = tokenParent; TokenBefore = tokenBefore; if (tokenAfter != null) { if (TokenAfter == null) { TokenAfter = new List<SToken>(); TokenAfter.Add(tokenAfter); if (tokenAfter.TokenChilds == null) { tokenAfter.TokenChilds = new List<SToken>(); } } } if (tokenChilds == null) { tokenChilds = new List<SToken>(); } TokenChilds = tokenChilds; }
private void Wrap(SToken token) { while (token != null) { if (token.TokenType == SElementType.Symbol) { TreeNode classNode = null; CodeFile newCodeFile = new CodeFile(); ElementNamespace namespaceItem = new ElementNamespace(); ElementClass classItem = new ElementClass(); bool isNeededCodeFileCreation = true; if (isNeededCodeFileCreation) { classNode = new TreeNode(token.TokenString); classNode.ImageKey = "class"; classNode.Tag = token; treeView1.Nodes.Add(classNode); } if (token.TokenProperties != null) { SToken tokenToRead = token; if (token.TokenProperties[0].TokenNodeType == SElementType.FoldOpen) { foreach (SToken localTokenF in token.TokenProperties[0].TokenChilds) { SToken localToken = localTokenF; while (localToken != null) { Wrap(localToken); ElementProperty newProperty = new ElementProperty(); TreeNode propertyNode = null; propertyNode.ImageKey = "property"; switch (localToken.TokenMultiplicity) { case SElementMultiplicity.Some: propertyNode = new TreeNode(localToken.TokenString); propertyNode.Tag = token; classNode.Nodes.Add(propertyNode); break; case SElementMultiplicity.Explicit: propertyNode = new TreeNode(localToken.TokenString); propertyNode.Tag = token; classNode.Nodes.Add(propertyNode); break; default: propertyNode = new TreeNode(localToken.TokenString); propertyNode.Tag = token; classNode.Nodes.Add(propertyNode); break; } //newProperty.PropertyType = localToken.TokenString; newProperty.ElementClassName = ToUp(localToken.TokenString); classItem.ElementProperties.Add(newProperty); if (localToken.TokenAfter != null) { localToken = localToken.TokenAfter[0]; } else { localToken = null; } } } } else foreach (SToken localToken in token.TokenProperties) { //Wrap(localToken); ElementProperty newProperty = new ElementProperty(); TreeNode propertyNode = null; switch (localToken.TokenMultiplicity) { case SElementMultiplicity.Some: propertyNode = new TreeNode(localToken.TokenString); propertyNode.Tag = token; propertyNode.ImageKey = "property"; classNode.Nodes.Add(propertyNode); break; case SElementMultiplicity.Explicit: propertyNode = new TreeNode(localToken.TokenString); propertyNode.Tag = token; propertyNode.ImageKey = "property"; classNode.Nodes.Add(propertyNode); break; default: propertyNode = new TreeNode(localToken.TokenString); propertyNode.Tag = token; propertyNode.ImageKey = "property"; classNode.Nodes.Add(propertyNode); break; } //newProperty.PropertyType = localToken.TokenString; newProperty.ElementClassName = ToUp(localToken.TokenString); classItem.ElementProperties.Add(newProperty); } } if (token.TokenActivities != null) { TreeNode actionNode = null; foreach (SToken localToken in token.TokenActivities) { Wrap(localToken); actionNode = new TreeNode(localToken.TokenString); actionNode.Tag = token; actionNode.ImageKey = "method"; classNode.Nodes.Add(actionNode); } } if (token.TokenInfluenceA != null) { TreeNode actionNode = null; foreach (SToken localToken in token.TokenInfluenceA) { ///if () //Wrap(localToken); actionNode = new TreeNode(localToken.TokenString); actionNode.Tag = token; actionNode.ImageKey = "increase"; classNode.Nodes.Add(actionNode); } } if (token.TokenInfluenceB != null) { TreeNode actionNode = null; foreach (SToken localToken in token.TokenInfluenceB) { // Wrap(localToken); actionNode = new TreeNode(localToken.TokenString); actionNode.Tag = token; actionNode.ImageKey = "decrease"; classNode.Nodes.Add(actionNode); } } if (token.TokenInfluenceC != null) { TreeNode actionNode = null; foreach (SToken localToken in token.TokenInfluenceC) { Wrap(localToken); actionNode = new TreeNode(localToken.TokenString); actionNode.Tag = token; actionNode.ImageKey = "increasedBy"; classNode.Nodes.Add(actionNode); } } if (token.TokenInfluenceD != null) { TreeNode actionNode = null; foreach (SToken localToken in token.TokenInfluenceD) { Wrap(localToken); actionNode = new TreeNode(localToken.TokenString); actionNode.Tag = token; actionNode.ImageKey = "decreasedBy"; classNode.Nodes.Add(actionNode); } } } foreach (SToken tokenlist in token.TokenChilds) { Wrap(tokenlist); } if (token.TokenAfter != null) { token = token.TokenAfter[0]; } else { token = null; } } }
public void Fill(SToken token) { while (token != null) { int column = documentHorizontalOffset + currentColumnOffset; int row = documentVerticalOffset + currentRowOffset; if (column < 10 && column > -1 && row < 10 && row > -1) { switch (column) { case 0: ((Item)dataGrid1.Items[row]).C0 = token.TokenString; //DataGridCellInfo cell = new DataGridCellInfo(((Item)dataGrid1.Items[documentVerticalOffset]).C0); //dataGrid1. new SolidColorBrush(Colors.White); //((DataGridRow)dataGrid1.Items[documentVerticalOffset]).BorderBrus break; case 1: ((Item)dataGrid1.Items[row]).C1 = token.TokenString; break; case 2: ((Item)dataGrid1.Items[row]).C2 = token.TokenString; break; case 3: ((Item)dataGrid1.Items[row]).C3 = token.TokenString; break; case 4: ((Item)dataGrid1.Items[row]).C4 = token.TokenString; break; case 5: ((Item)dataGrid1.Items[row]).C5 = token.TokenString; break; case 6: ((Item)dataGrid1.Items[row]).C6 = token.TokenString; break; case 7: ((Item)dataGrid1.Items[row]).C7 = token.TokenString; break; case 8: ((Item)dataGrid1.Items[row]).C8 = token.TokenString; break; case 9: ((Item)dataGrid1.Items[row]).C9 = token.TokenString; break; } } documentHorizontalOffset++; if (token.TokenProperties != null) foreach (SToken tokenlist in token.TokenProperties) { documentVerticalOffset++; Fill(tokenlist); documentVerticalOffset--; } foreach (SToken tokenlist in token.TokenChilds) { documentVerticalOffset++; Fill(tokenlist); documentVerticalOffset--; } if (token.TokenAfter != null) { token = token.TokenAfter[0]; } else { token = null; } } }