コード例 #1
0
        public Measure Divide(DerivedMeasure d)
        {
            if (d == this)
            {
                return(new BaseMeasure());
            }
            var a = new MeasureTerms();

            foreach (var e in Terms)
            {
                var c = new MeasureTerm {
                    Measure = e.Measure, Power = e.Power
                };
                a.Add(c);
            }
            foreach (var e in d.Terms)
            {
                var c = new MeasureTerm {
                    Measure = e.Measure, Power = e.Power
                };
                c.Power = -c.Power;
                a.Add(c);
            }
            a.RemoveAll(x => x.Power == 0);
            return(new DerivedMeasure(a));
        }
コード例 #2
0
        public Measure Multiply(DerivedMeasure m)
        {
            var t = new MeasureTerms();

            t.Add(new MeasureTerm(this, 1));
            foreach (var e in m.Terms)
            {
                t.Add(new MeasureTerm(e.Measure as BaseMeasure, e.Power));
            }
            return(new DerivedMeasure(t));
        }
コード例 #3
0
ファイル: DerivedMeasure.cs プロジェクト: pihlakad/Project
        public Measure Multiply(DerivedMeasure d)
        {
            var a = new MeasureTerms();

            foreach (var e in Terms)
            {
                var c = Clone(e);
                a.Add(c);
            }
            foreach (var e in d.Terms)
            {
                var c = Clone(e);
                a.Add(c);
            }
            return(new DerivedMeasure(a));
        }
コード例 #4
0
        public Measure Multiply(DerivedMeasure d)
        {
            var a = new MeasureTerms();

            foreach (var e in Terms)
            {
                var c = new MeasureTerm {
                    Measure = e.Measure, Power = e.Power
                };
                a.Add(c);
            }
            foreach (var e in d.Terms)
            {
                var c = new MeasureTerm {
                    Measure = e.Measure, Power = e.Power
                };
                a.Add(c);
            }
            return(new DerivedMeasure(a));
        }
コード例 #5
0
ファイル: DerivedMeasure.cs プロジェクト: pihlakad/Project
        public Measure Reciprocal()
        {
            var a = new MeasureTerms();

            foreach (var e in Terms)
            {
                var c = Clone(e);
                c.Power = c.Power * -1;
                a.Add(c);
            }
            return(new DerivedMeasure(a));
        }
コード例 #6
0
ファイル: DerivedMeasure.cs プロジェクト: pihlakad/Project
        public Measure Divide(DerivedMeasure d)
        {
            if (d == this)
            {
                return(Empty);
            }
            var a = new MeasureTerms();

            foreach (var e in Terms)
            {
                var c = Clone(e);
                a.Add(c);
            }
            foreach (var e in d.Terms)
            {
                var c = Clone(e);
                c.Power = -c.Power;
                a.Add(c);
            }
            a.RemoveAll(x => x.Power == 0);
            return(new DerivedMeasure(a));
        }
コード例 #7
0
        public Measure Reciprocal()
        {
            var a = new MeasureTerms();

            foreach (var e in Terms)
            {
                var c = new MeasureTerm {
                    Measure = e.Measure, Power = e.Power
                };
                c.Power *= -1;
                a.Add(c);
            }
            return(new DerivedMeasure(a));
        }
コード例 #8
0
ファイル: DerivedMeasure.cs プロジェクト: pihlakad/Project
        public Measure Exponentiation(int i)
        {
            if (i == 0)
            {
                return(Empty);
            }
            var a = new MeasureTerms();

            foreach (var e in Terms)
            {
                var c = Clone(e);
                c.Power = c.Power * i;
                a.Add(c);
            }
            return(new DerivedMeasure(a));
        }
コード例 #9
0
        public Measure Exponentiation(int i)
        {
            if (i == 0)
            {
                return(new BaseMeasure());
            }
            var a = new MeasureTerms();

            foreach (var e in Terms)
            {
                var c = new MeasureTerm {
                    Measure = e.Measure, Power = e.Power
                };
                c.Power *= i;
                a.Add(c);
            }
            return(new DerivedMeasure(a));
        }