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

namespace FormulaEditor
{
    public class StringObjectConcatOperation : IObjectOperation, IBinaryAcceptor
    {

        static public readonly StringObjectConcatOperation Object =
            new StringObjectConcatOperation();

        protected StringObjectConcatOperation()
        {
        }

        #region IObjectOperation Members

        int IObjectOperation.Arity
        {
            get { return 2; }
        }

        object IObjectOperation.this[object[] x]
        {
            get { return "" + x[0] + x[1]; }
        }

        object IObjectOperation.ReturnType
        {
            get { return ""; }
        }

        bool IObjectOperation.IsPowered
        {
            get { return false; }
        }

        #endregion

        #region IBinaryAcceptor Members

        public IObjectOperation Accept(object typeA, object typeB)
        {
            if (typeA == null | typeB == null)
            {
                return null;
            }
            return this;
        }

        #endregion
}
}
