Exemplo n.º 1
0
        bool CheckRightContext(Rule _rule, string _str, int _index)
        {
            if (_index + _rule.rightContext.Length + 1 < _str.Length)
            {
                string rightContextInStr = _str.Substring(_index + 1, _rule.rightContext.Length);
                bool rightContextMatch = rightContextInStr.CompareTo(_rule.rightContext) == 0;
                if (rightContextInStr != "")
                {
                    PrintDebugLog("LSystem::CheckRightContext() - Right context: " + _rule.rightContext);
                    PrintDebugLog("LSystem::CheckRightContext() - Right context in current: " + rightContextInStr);
                }

                return rightContextMatch;
            }

            return false;
        }
Exemplo n.º 2
0
        bool CheckLeftContext(Rule _rule, string _str, int _index)
        {
            if (_index - _rule.leftContext.Length > 0 && _str.Length > _rule.leftContext.Length)
            {
                string leftContextInStr = _str.Substring(_index - _rule.leftContext.Length, _rule.leftContext.Length);
                bool leftContextMatch = leftContextInStr.CompareTo(_rule.leftContext) == 0;
                if (leftContextInStr != "")
                {
                    PrintDebugLog("LSystem::CheckLeftContext() - Left context: " + _rule.leftContext);
                    PrintDebugLog("LSystem::CheckLeftContext() - Left context in current: " + leftContextInStr);
                }

                return leftContextMatch;
            }

            return false;
        }