public override List <String> doRule(SQLElement eaElement, SQLWrapperClasses.SQLRepository repository)
        {
            List <String> results = new List <string>();

            if (eaElement.Stereotype == SDMModelingMain.StatementNodeStereotype)
            {
                StatementNode statementNode = new StatementNode(repository, eaElement);
                statementNode.loadTreeFromTaggedValue();

                if (statementNode.StatementExpression != null)
                {
                    String result = statementNode.StatementExpression.ToString();
                    if (!ConsistencyUtil.checkExpression(eaElement, statementNode.StatementExpression, repository))
                    {
                        results.Add("StatementExpression is invalid: (" + result + ")");
                    }
                }
                else
                {
                    results.Add("StatementExpression is missing");
                }

                foreach (SQLConnector outgoingCon in eaElement.Connectors)
                {
                    if (outgoingCon.ClientID == eaElement.ElementID)
                    {
                        ActivityEdge edge = new ActivityEdge(repository, outgoingCon);
                        edge.loadTreeFromTaggedValue();
                        if (edge.GuardType == EdgeGuard.FAILURE || edge.GuardType == EdgeGuard.SUCCESS)
                        {
                            if (statementNode.StatementExpression is MethodCallExpression)
                            {
                                MethodCallExpression mCe    = statementNode.StatementExpression as MethodCallExpression;
                                SQLMethod            method = repository.GetMethodByGuid(mCe.MethodGuid);

                                if (method != null && method.ReturnType != "EBoolean")
                                {
                                    results.Add("Method must be of type EBoolean if StatementNode has success/failure guards");
                                }
                            }
                        }
                    }
                }
            }
            return(results);
        }
Exemplo n.º 2
0
        public override List <String> doRule(SQLElement eaElement, SQLWrapperClasses.SQLRepository repository)
        {
            List <String> results = new List <string>();

            if (eaElement.Stereotype == SDMModelingMain.ObjectVariableStereotype ||
                eaElement.Stereotype == TGGModelingMain.TggObjectVariableStereotype ||
                eaElement.Stereotype == TGGModelingMain.TggCorrespondenceStereotype)
            {
                ObjectVariable ov = new ObjectVariable(eaElement, repository);
                ov.loadTreeFromTaggedValue();
                if (ov.BindingExpression != null)
                {
                    if (!ConsistencyUtil.checkExpression(eaElement, ov.BindingExpression, repository))
                    {
                        results.Add("BindingExpression is Invalid: (" + ov.BindingExpression.ToString() + ")");
                    }
                }
            }
            return(results);
        }
Exemplo n.º 3
0
        public override List <String> doRule(SQLElement eaElement, SQLWrapperClasses.SQLRepository repository)
        {
            List <String> results = new List <string>();

            if (eaElement.Stereotype == SDMModelingMain.StopNodeStereotype)
            {
                StopNode stopNode = new StopNode(repository, eaElement);
                stopNode.loadTreeFromTaggedValue();

                if (stopNode.ReturnValue != null)
                {
                    Boolean isValid = ConsistencyUtil.checkExpression(eaElement, stopNode.ReturnValue, repository);
                    if (!isValid)
                    {
                        String output = "StopNode returnValue is invalid and must be updated manually";
                        output += ConsistencyUtil.getExpressionOutput(stopNode.ReturnValue, repository);
                        results.Add(output);
                    }
                }
            }
            return(results);
        }
Exemplo n.º 4
0
        public override List <string> doRule(SQLElement eaElement, SQLWrapperClasses.SQLRepository repository)
        {
            List <String> results = new List <string>();

            if (eaElement.Stereotype == TGGModelingMain.CSPConstraintStereotype || eaElement.Stereotype == "TGGCsp")
            {
                SQLElement parentElement = repository.GetElementByID(eaElement.ParentID);
                if (parentElement.Stereotype != SDMModelingMain.StoryNodeStereotype)
                {
                    CSPInstance csp = new CSPInstance(repository, eaElement);
                    if (csp.loadTreeFromTaggedValue())
                    {
                        foreach (CSPInstanceEntry instance in csp.createdEntries)
                        {
                            foreach (Expression exp in instance.typedInExpressions)
                            {
                                if (!ConsistencyUtil.checkExpression(eaElement, exp, repository))
                                {
                                    results.Add("Tgg CSP expression is invalid: " + exp);
                                }
                            }
                        }
                    }
                    else
                    {
                        results.Add("Tgg CSP is outdated and maybe erroneous - updating it manually is recommended");
                    }
                }
            }
            else if (eaElement.Type == "Constraint")
            {
                results.Add("Tgg CSP is outdated and cant be modified - quickfix is recommended");
            }

            return(results);
        }