private void BuildPath(List <IStatementList> paths, IStatementList path, Statement lastElement) { Statement element = path.GetSize() > 0 ? path.GetLast() : lastElement; if (path.GetSize() == 0 || element != lastElement) { IStatementList nexting = GetNext(element); if (nexting.GetSize() > 0) { if (nexting.GetLast() != nexting.GetFirst()) { IStatementList newPath = path.Copy(); newPath.AddStatement(nexting.GetLast()); BuildPath(paths, newPath, element); } path.AddStatement(nexting.GetFirst()); BuildPath(paths, path, element); } else { paths.Add(path); } } else { paths.Add(path); } }
public IStatementList GetNextT(Statement statement) { IStatementList nexting = GetNext(statement); for (int i = 0; i < nexting.GetSize(); i++) { nexting.Sum(GetNext(nexting[i])); } return(nexting); }
public IStatementList GetNextedByT(Statement statement) { IStatementList nexted = GetNextedBy(statement); for (int i = 0; i < nexted.GetSize(); i++) { nexted.Sum(GetNextedBy(nexted[i])); } return(nexted); }
public IStatementList GetParentedByT(Statement statement) { IStatementList parented = GetParentedBy(statement); for (int i = 0; i < parented.GetSize(); i++) { parented.Sum(GetParentedBy(parented[i])); } return(parented); }
public IStatementList GetAffectsT(Assign assignment) { IStatementList affecting = GetAffects(assignment); for (int i = 0; i < affecting.GetSize(); i++) { Assign affectingAssignment = affecting[i] as Assign; affecting.Sum(GetAffects(affectingAssignment)); } return(affecting); }
public IStatementList GetAffectedByT(Assign assignment) { IStatementList affected = GetAffectedBy(assignment); for (int i = 0; i < affected.GetSize(); i++) { Assign affectedAssignment = affected[i] as Assign; affected.Sum(GetAffectedBy(affectedAssignment)); } return(affected); }
public IStatementList GetFollowsT(Statement statement) { IStatementList following = ImplementationFactory.CreateStatementList(); Statement followingStatement = GetFollows(statement); following.AddStatement(followingStatement); for (int i = 0; i < following.GetSize(); i++) { following.AddStatement(GetFollows(following[i])); } return(following); }
public IStatementList GetFollowedByT(Statement statement) { IStatementList followed = ImplementationFactory.CreateStatementList(); Statement followedStatement = GetFollowedBy(statement); followed.AddStatement(followedStatement); for (int i = 0; i < followed.GetSize(); i++) { followed.AddStatement(GetFollowedBy(followed[i])); } return(followed); }
public IStatementList GetParentT(Statement statement) { IStatementList parents = ImplementationFactory.CreateStatementList(); Statement parentStatement = GetParent(statement); parents.AddStatement(parentStatement); for (int i = 0; i < parents.GetSize(); i++) { parents.AddEntity(GetParent(parents[i])); } return(parents); }
private void ExtractProcedure(Procedure procedure) { IStatementList children = procedure.Body; for (int i = 0; i < children.GetSize(); i++) { Statement child = children[i]; ExtractStatement(child, procedure); if (i > 0) { Statement previousChild = children[i - 1]; FollowsTable.SetFollows(previousChild, child); if (!(previousChild is If)) { NextTable.SetNext(previousChild, child); } else { ExtractIfNext(previousChild as If, child); } } IVariableList modifiedVariables = ModifiesTable.GetModifiedBy(child); IVariableList usedVariables = UsesTable.GetUsedBy(child); foreach (Variable variable in modifiedVariables) { ModifiesTable.SetModifies(procedure, variable); } foreach (Variable variable in usedVariables) { UsesTable.SetUses(procedure, variable); } } }
private void ExtractBody(Container container, IStatementList body, Procedure procedureContext) { for (int i = 0; i < body.GetSize(); i++) { Statement child = body[i]; ExtractStatement(child, procedureContext); ParentTable.SetParent(container, child); if (i > 0) { Statement previousChild = body[i - 1]; FollowsTable.SetFollows(previousChild, child); if (!(previousChild is If)) { NextTable.SetNext(previousChild, child); } else { ExtractIfNext(previousChild as If, child); } } IVariableList modifiedVariables = ModifiesTable.GetModifiedBy(child); IVariableList usedVariables = UsesTable.GetUsedBy(child); foreach (Variable variable in modifiedVariables) { ModifiesTable.SetModifies(container, variable); } foreach (Variable variable in usedVariables) { UsesTable.SetUses(container, variable); } } }