コード例 #1
0
ファイル: VariableMeasure.cs プロジェクト: Erroman/universal
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="symbol">Symbol of variable</param>
        /// <param name="measure">Measure</param>
        /// <param name="detector">Detector of variables</param>
        internal VariableMeasurement(string symbol, IMeasurement measure, IVariableDetector detector)
        {
            this.symbol      = symbol;
            this.measurement = measure;
            this.detector    = detector;
            object par = measure.Type;

            if (par is IOneVariableFunction)
            {
                func = par as IOneVariableFunction;
                operationDetector = new OneVariableFunctionDetector(detector);
                funcwrapper       = new OneVariableFunctionDetector(func);
            }
            else if (par is Table2D)
            {
                table2D = par as Table2D;
            }
            else if (par is Table3D)
            {
                table3D = par as Table3D;
            }

            /*!!!   else if (par is FuncReturn)
             * {
             *     funcReturn = par as FuncReturn;
             *     //operationDetector = new FormulaEditor.Func.FuncDetector(detector,  )
             * }*/
            else
            {
                acceptor = this;
            }
            tree = new ObjectFormulaTree(this, new List <ObjectFormulaTree>());
        }
コード例 #2
0
        protected ExtendedFormulaCreator(IVariableDetector detector)
            : base(detector, false)
        {
            opDetectors = new IOperationDetector[]
            { new OneVariableFunctionDetector(detector), new ExtendedOperationDetector(detector, this) //,
              /*!!! new Func.FuncDetector(detector) */ };
            ElementaryBinaryDetector plus = new ElementaryBinaryDetector('+');

            plus.Add(StringConcatOperation.Object);
            /// Has higher priority than other '+'-type operators, causes a bug
            plus.Add(StringObjectConcatOperation.Object);
            LikeOperation like = new LikeOperation();

            like.Add(LikeObjectOperation.Object);
            detectors = new IBinaryDetector[]
            {
                new LogicalDetector('\u2217'), new LogicalDetector('\u2216'), new LogicalDetector('\u8835'),
                LogicalEqualityDetector.Object,
                new BitDetector('|'), new BitDetector('&'), new BitDetector('^'),
                new BitDetector('\u2266'), new BitDetector('\u2267'),
                ComparationDetector.Object, like, RealMatrixBinary.Singleton,
                RealVectorBinary.Singleton,
                plus, new ElementaryBinaryDetector('-'),
                RealMatrixMultiplication.Singleton,
                new ElementaryBinaryDetector('*'),
                new ElementaryDivisionDetector('/'),
                new ElementaryDivisionDetector('﹪'),
                Vector3DProduct.Object,
                WhereDetector.Singleton,
                OrderByDetector.Singleton,
                AverageDetector.Singleton
            };
        }
コード例 #3
0
        public static IFormulaObjectCreator GetCreator(IVariableDetector detector, IEnumerable <IOperationDetector> additional,
                                                       IEnumerable <IBinaryDetector> binary)
        {
            IFormulaObjectCreator prot = new ExtendedFormulaCreator(detector);

            prot.Add(ElementaryRealDetector.Object);
            prot.Add(PropertyFictionOperation.Singleton);
            prot.Add(BinaryPropertyDetector.Singleton);
            foreach (IOperationDetector d in additional)
            {
                prot.Add(d);
            }
            foreach (IBinaryDetector d in binary)
            {
                prot.Add(d);
            }
            IFormulaObjectCreator creator = new FormulaArrayObjectCreator(prot);

            foreach (IOperationDetector d in additional)
            {
                creator.Add(d);
            }
            foreach (IBinaryDetector d in binary)
            {
                creator.Add(d);
            }
            return(creator);
        }
コード例 #4
0
ファイル: VariableDetector.cs プロジェクト: Erroman/universal
        /// <summary>
        /// Gets creator
        /// </summary>
        /// <param name="detector">Detector</param>
        /// <returns>Creator</returns>
        static public IFormulaObjectCreator GetCreator(IVariableDetector detector)
        {
            List <IOperationDetector> l = new List <IOperationDetector>();

            l.AddRange(StaticExtensionDataPerformerFormula.OperationDetectors);
            l.Add(new DerivationDetector("d/dt", "d/dt"));
            return(ExtendedFormulaCreator.GetCreator(detector, l, StaticExtensionDataPerformerFormula.BinaryDetectors));
        }
コード例 #5
0
        public static IFormulaObjectCreator GetCreator(IVariableDetector detector)
        {
            IFormulaObjectCreator prot = new ExtendedFormulaCreator(detector);

            prot.Add(ElementaryRealDetector.Object);
            IFormulaObjectCreator creator = new FormulaArrayObjectCreator(prot);

            return(creator);
        }
コード例 #6
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="detector">Detector of variables</param>
 /// <param name="init">Initialization sign</param>
 protected ElementaryObjectsCreator(IVariableDetector detector, bool init)
     : base(init)
 {
     if (!init)
     {
         return;
     }
     opDetectors =
         new IOperationDetector[] { new OneVariableFunctionDetector(detector), new ElementaryObjectDetector(detector) };
 }
コード例 #7
0
 internal VariableMeasureDistribution(string symbol, IMeasurement measure,
                                      IDistribution distribution, IVariableDetector detector)
     : base(symbol, measure, detector)
 {
     this.distribution = distribution;
 }
コード例 #8
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="detector">Detector of variable</param>
 public ElementaryObjectDetector(IVariableDetector detector)
 {
     this.detector = detector;
 }
コード例 #9
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="table">Table of variable types</param>
 public ElementaryObjectDetector(Dictionary <char, object> table)
 {
     this.table = table;
     detector   = this;
 }
コード例 #10
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="varDetector">Variable detector</param>
 public OneVariableFunctionDetector(IVariableDetector varDetector)
 {
     this.varDetector = varDetector;
 }
コード例 #11
0
 /// <summary>
 /// Constuctor
 /// </summary>
 /// <param name="table">Table of variables</param>
 public OneVariableFunctionDetector(Dictionary <char, object> table)
 {
     this.table  = table;
     varDetector = this;
 }
コード例 #12
0
 internal ExtendedOperationDetector(IVariableDetector detector, IFormulaObjectCreator creator)
     : base(detector)
 {
     this.creator = creator;
 }
コード例 #13
0
 /// <summary>
 /// Creates variable measurement
 /// </summary>
 /// <param name="symbol">The symbol</param>
 /// <param name="measurement">The measurement</param>
 /// <param name="detector">The detector</param>
 /// <returns>The variable</returns>
 static public VariableMeasurement Create(this char symbol, IMeasurement measure, IVariableDetector detector)
 {
     return(Create(symbol + "", measure, detector));
 }
コード例 #14
0
        /// <summary>
        /// Creates variable measurement
        /// </summary>
        /// <param name="symbol">The symbol</param>
        /// <param name="measurement">The measurement</param>
        /// <param name="detector">The detector</param>
        /// <returns>The variable</returns>
        static public VariableMeasurement Create(this string symbol, IMeasurement measurement, IVariableDetector detector)
        {
            if (!(measurement is IDistribution))
            {
                return(new VariableMeasurement(symbol, measurement, detector));
            }
            IDistribution distribution = measurement as IDistribution;

            return(new VariableMeasureDistribution(symbol, measurement, distribution, detector));
        }