private string formatSentence(ConditionOwner owner, string sentence)
        {
            string formattedSentence = sentence;

            if (sentence.Contains(ELEMENT_TYPE))
            {
                //formattedSentence = formattedSentence.replace(ELEMENT_TYPE,
                //    "<i>" + Language.GetTextElement(owner.getOwnerType()) + "</i>");
            }
            if (sentence.Contains(ELEMENT_ID))
            {
                formattedSentence = formattedSentence.Replace(ELEMENT_ID, "<b>\"" + owner.getOwnerName() + "\"</b>");
            }
            return(formattedSentence);
        }
Exemplo n.º 2
0
        /**
         * Sets the evaluation function at the given index
         *
         * @param index1
         *            Int value in rage
         * @param index2
         *            Int value in rage or {@link #INDEX_NOT_USED} if not applicable
         * @param value
         *            {@link #EVAL_FUNCTION_AND} | {@link #EVAL_FUNCTION_OR}
         * @return
         */

        //public bool setEvalFunction(int index1, int index2, int value)
        //{

        //    // Check value
        //    if (value != EVAL_FUNCTION_AND && value != EVAL_FUNCTION_OR)
        //        return false;

        //    // Check index
        //    // Check if the algorithm must search deeper (index2==-1 means no search inside blocks must be carried out)
        //    if (index2 == -1)
        //    {
        //        if (index1 < 0 || index1 >= conditions.size() - 1)
        //            return false;
        //    }
        //    else if (index2 >= 0)
        //    {
        //        if (index1 < 0 || index1 >= conditions.size())
        //            return false;
        //    }

        //    return Controller.getInstance().addTool(new SetEvalFunctionTool(conditions, index1, index2, value));
        //}

        //Condition type. Values: GLOBAL_STATE | CONDITION

        /**
         * The Dictionary of the context
         */

        public Dictionary <string, ConditionContextProperty> getContext()
        {
            Dictionary <string, ConditionContextProperty> currentContext = new Dictionary <string, ConditionContextProperty>();

            foreach (string key in context.Keys)
            {
                currentContext.Add(key, context[key]);
            }

            if (currentContext.ContainsKey(CONDITION_OWNER))
            {
                ConditionOwner owner = (ConditionOwner)currentContext[CONDITION_OWNER];
                if (owner.getOwnerType() == Controller.GLOBAL_STATE)
                {
                    string ownerId = owner.getOwnerName();

                    //ConditionRestrictions restrictions = new ConditionRestrictions( new string[] { ownerId } );
                    //ConditionRestrictions restrictions = new ConditionRestrictions(exceptions(ownerId));
                    //currentContext.Add(CONDITION_RESTRICTIONS, restrictions);
                }
            }

            return(currentContext);
        }