コード例 #1
0
        public void Process(IProgramKnowledgeBase pkb, BindingsManager bindingsManager)
        {
            IEntityList leftBounds = ImplementationFactory.CreateEntityList();

            for (int i = 0; i < RightArgs.GetSize(); i++)
            {
                IEntity     arg    = RightArgs[i];
                IEntityList result = ImplementationFactory.CreateEntityList();
                string      attributeValue;
                if (RightType == PqlTokenType.CALL && (LeftType == PqlTokenType.PROCEDURE || LeftType == PqlTokenType.VARIABLE))
                {
                    attributeValue = arg.SecondaryAttribute.AttributeValue;
                }
                else
                {
                    attributeValue = arg.Attribute.AttributeValue;
                }

                if (LeftType == PqlTokenType.CALL && LeftRef.AttributeName.Equals("procName"))
                {
                    result.Sum(pkb.Statements.Copy().FilterBySecondaryAttribute(attributeValue));
                }
                else if (LeftType == PqlTokenType.PROCEDURE)
                {
                    result.AddEntity(pkb.Procedures.GetProcedureByName(attributeValue));
                }
                else if (LeftType == PqlTokenType.VARIABLE)
                {
                    result.AddEntity(pkb.Variables.GetVariableByName(attributeValue));
                }
                else
                {
                    result.AddEntity(pkb.Statements.GetEntityByAttribute(attributeValue));
                }

                if (RightRef is PqlSynonym)
                {
                    bindingsManager.CreateMultipleBindingsOneWay(arg, result, RightArgs, LeftArgs);
                }
                leftBounds.Sum(result);
            }
            LeftArgs.Intersection(leftBounds, bindingsManager);
        }