StateOnly() static private method

static private StateOnly ( int state ) : int
state int
return int
        internal bool BeginEvent(XPathNodeType nodeType, string prefix, string name, string nspace, bool empty, Object htmlProps, bool search)
        {
            Debug.Assert(this.xsm != null);

            int stateOutlook = this.xsm.BeginOutlook(nodeType);

            if (this.ignoreLevel > 0 || stateOutlook == StateMachine.Error)
            {
                this.ignoreLevel++;
                return(true);                        // We consumed the event, so pretend it was output.
            }

            switch (this.builder.BeginEvent(stateOutlook, nodeType, prefix, name, nspace, empty, htmlProps, search))
            {
            case OutputResult.Continue:
                this.xsm.Begin(nodeType);
                Debug.Assert(StateMachine.StateOnly(stateOutlook) == this.xsm.State);
                Debug.Assert(ExecutionResult == ExecResult.Continue);
                return(true);

            case OutputResult.Interrupt:
                this.xsm.Begin(nodeType);
                Debug.Assert(StateMachine.StateOnly(stateOutlook) == this.xsm.State);
                ExecutionResult = ExecResult.Interrupt;
                return(true);

            case OutputResult.Overflow:
                ExecutionResult = ExecResult.Interrupt;
                return(false);

            case OutputResult.Error:
                this.ignoreLevel++;
                return(true);

            case OutputResult.Ignore:
                return(true);

            default:
                Debug.Fail("Unexpected result of RecordBuilder.BeginEvent()");
                return(true);
            }
        }
        internal bool TextEvent(string text, bool disableOutputEscaping)
        {
            Debug.Assert(this.xsm != null);

            if (this.ignoreLevel > 0)
            {
                return(true);
            }

            int stateOutlook = this.xsm.BeginOutlook(XPathNodeType.Text);

            switch (this.builder.TextEvent(stateOutlook, text, disableOutputEscaping))
            {
            case OutputResult.Continue:
                this.xsm.Begin(XPathNodeType.Text);
                Debug.Assert(StateMachine.StateOnly(stateOutlook) == this.xsm.State);
                Debug.Assert(ExecutionResult == ExecResult.Continue);
                return(true);

            case OutputResult.Interrupt:
                this.xsm.Begin(XPathNodeType.Text);
                Debug.Assert(StateMachine.StateOnly(stateOutlook) == this.xsm.State);
                ExecutionResult = ExecResult.Interrupt;
                return(true);

            case OutputResult.Overflow:
                ExecutionResult = ExecResult.Interrupt;
                return(false);

            case OutputResult.Error:
            case OutputResult.Ignore:
                return(true);

            default:
                Debug.Fail("Unexpected result of RecordBuilder.TextEvent()");
                return(true);
            }
        }
        internal bool EndEvent(XPathNodeType nodeType)
        {
            Debug.Assert(this.xsm != null);

            if (this.ignoreLevel > 0)
            {
                this.ignoreLevel--;
                return(true);
            }

            int stateOutlook = this.xsm.EndOutlook(nodeType);

            switch (this.builder.EndEvent(stateOutlook, nodeType))
            {
            case OutputResult.Continue:
                this.xsm.End(nodeType);
                Debug.Assert(StateMachine.StateOnly(stateOutlook) == this.xsm.State);
                return(true);

            case OutputResult.Interrupt:
                this.xsm.End(nodeType);
                Debug.Assert(StateMachine.StateOnly(stateOutlook) == this.xsm.State,
                             "StateMachine.StateOnly(stateOutlook) == this.xsm.State");
                ExecutionResult = ExecResult.Interrupt;
                return(true);

            case OutputResult.Overflow:
                ExecutionResult = ExecResult.Interrupt;
                return(false);

            case OutputResult.Error:
            case OutputResult.Ignore:
            default:
                Debug.Fail("Unexpected result of RecordBuilder.TextEvent()");
                return(true);
            }
        }