internal virtual String Expand(CapabilitiesState matchstate)
        {
            StringBuilder sb     = null;
            String        result = null;

            for (int i = 0; i < _rules.Length; i++)
            {
                if (sb == null && result != null)
                {
                    sb = new StringBuilder(result);
                }

                switch (_rules[i])
                {
                case Literal:
                    result = _strings[i];
                    break;

                case Reference:
                    result = matchstate.ResolveReference(_strings[i]);
                    break;

                case Variable:
                    result = matchstate.ResolveVariable(_strings[i]);
                    break;
                }

                if (sb != null && result != null)
                {
                    sb.Append(result);
                }
            }

            if (sb != null)
            {
                return(sb.ToString());
            }

            if (result != null)
            {
                return(result);
            }

            return("");
        }
Ejemplo n.º 2
0
        internal virtual string Expand(CapabilitiesState matchstate)
        {
            StringBuilder builder = null;
            string        str     = null;

            for (int i = 0; i < this._rules.Length; i++)
            {
                if ((builder == null) && (str != null))
                {
                    builder = new StringBuilder(str);
                }
                switch (this._rules[i])
                {
                case 0:
                    str = this._strings[i];
                    break;

                case 1:
                    str = matchstate.ResolveReference(this._strings[i]);
                    break;

                case 2:
                    str = matchstate.ResolveVariable(this._strings[i]);
                    break;
                }
                if ((builder != null) && (str != null))
                {
                    builder.Append(str);
                }
            }
            if (builder != null)
            {
                return(builder.ToString());
            }
            if (str != null)
            {
                return(str);
            }
            return(string.Empty);
        }
        internal virtual String Expand(CapabilitiesState matchstate) {
            StringBuilder sb = null;
            String result = null;

            for (int i = 0; i < _rules.Length; i++) {
                if (sb == null && result != null)
                    sb = new StringBuilder(result);

                switch (_rules[i]) {
                    case Literal:
                        result = _strings[i];
                        break;

                    case Reference:
                        result = matchstate.ResolveReference(_strings[i]);
                        break;

                    case Variable:
                        result = matchstate.ResolveVariable(_strings[i]);
                        break;
                }

                if (sb != null && result != null)
                    sb.Append(result);
            }

            if (sb != null)
                return sb.ToString();

            if (result != null)
                return result;

            return String.Empty;
        }
        internal virtual string Expand(CapabilitiesState matchstate)
        {
            StringBuilder builder = null;
            string str = null;
            for (int i = 0; i < this._rules.Length; i++)
            {
                if ((builder == null) && (str != null))
                {
                    builder = new StringBuilder(str);
                }
                switch (this._rules[i])
                {
                    case 0:
                        str = this._strings[i];
                        break;

                    case 1:
                        str = matchstate.ResolveReference(this._strings[i]);
                        break;

                    case 2:
                        str = matchstate.ResolveVariable(this._strings[i]);
                        break;
                }
                if ((builder != null) && (str != null))
                {
                    builder.Append(str);
                }
            }
            if (builder != null)
            {
                return builder.ToString();
            }
            if (str != null)
            {
                return str;
            }
            return string.Empty;
        }