using System;
using System.Collections.Generic;
using System.Text;

namespace FormulaEditor
{
    public class BinaryArrayOperationDetector : IBinaryDetector
    {

        #region Fields

        /// <summary>
        /// Operation acceptor
        /// </summary>
        private IBinaryDetector detector;


        #endregion

        #region Constructors

        public BinaryArrayOperationDetector(IBinaryDetector detector)
        {
            this.detector = detector;
        }

        #endregion

        #region IBinaryDetector Members

        public FormulaEditor.BinaryAssociationDirection AssociationDirection
        {
            get
            {
                return detector.AssociationDirection;
            }
        }

        public IBinaryAcceptor Detect(MathSymbol s)
        {
            IBinaryAcceptor acc = detector.Detect(s);
            if (acc == null)
            {
                return null;
            }
            return new BinaryArrayOperationAcceptor(acc);
        }

        #endregion
    }
}
