Пример #1
0
        public int CompareTo(Fitness that)
        {
            if (ReferenceEquals(this, that))
            {
                return(0);
            }
            if (that is null)
            {
                return(1);
            }
            var value = TotalValue.CompareTo(that.TotalValue);

            if (value != 0)
            {
                return(value);
            }

            var weight = -TotalWeight.CompareTo(that.TotalWeight);

            if (weight != 0)
            {
                return(weight);
            }

            var volume = -TotalVolume.CompareTo(that.TotalVolume);

            return(volume);
        }
Пример #2
0
        void PlotChart()
        {
            if (Showtotalvolume)
            {
                TotalVolume.Set(totalvolume);
            }

            if (deltamode)
            {
                if (deltavolume > 0)
                {
                    UpVolume.Set(deltavolume);
                    DownVolume.Set(0);
                }
                else if (deltavolume < 0)
                {
                    UpVolume.Set(0);
                    DownVolume.Set((revneg) ? deltavolume : -deltavolume);
                }
                else
                {
                    UpVolume.Set(0);
                    DownVolume.Set(0);
                }
            }
            else
            {
                UpVolume.Set(upvolume);
                DownVolume.Set(downvolume);
            }
        }
Пример #3
0
        public void Constructor3ShouldStoreAndPrintValueAndSymbolWithFt3()
        {
            Porosity      p  = new Porosity(.1);
            VolumeOfVoids vv = new VolumeOfVoids(10, VolumeUnits.CubicCentimeters);
            TotalVolume   tv = new TotalVolume(p, vv, VolumeUnits.CubicFeet);

            Assert.AreEqual("V", tv.Symbol);
            Assert.AreEqual(Math.Round(tv.NumericValue, 5), 0.00353);
            Assert.AreEqual(tv.UnitOfMeasure, VolumeUnits.CubicFeet);
        }
Пример #4
0
        public void Constructor1ShouldStoreAndPrintValueAndSymbol()
        {
            TotalVolume tv            = new TotalVolume(10, VolumeUnits.CubicCentimeters);
            String      correctAnswer = "V = 10 cc";

            Assert.AreEqual("V", tv.Symbol);
            Assert.AreEqual(tv.NumericValue, 10);
            Assert.AreEqual(tv.UnitOfMeasure, VolumeUnits.CubicCentimeters);
            Assert.AreEqual(correctAnswer, tv.ToString());
        }
Пример #5
0
        public void Constructor2ShouldStoreAndPrintValueAndSymbolWithPoundPerFootCubed()
        {
            TotalWeight     tw  = new TotalWeight(10, WeightUnits.Grams);
            TotalVolume     tv  = new TotalVolume(10, VolumeUnits.CubicCentimeters);
            TotalUnitWeight tuw = new TotalUnitWeight(tw, tv, UnitWeightUnits.PoundPerCubicFoot);

            Assert.AreEqual(Math.Round(tuw.NumericValue, 2), 62.43);
            Assert.AreEqual(tuw.UnitOfMeasure, UnitWeightUnits.PoundPerCubicFoot);
            Assert.AreEqual(tuw.Symbol, "𝛾_t");;
        }
Пример #6
0
        public void Constructor3ShouldStoreAndPrintValueAndSymbolWithKilograms()
        {
            MassSpecificGravity msg = new MassSpecificGravity(10);
            UnitWeightOfWater   uww = new UnitWeightOfWater(1, UnitWeightUnits.GramPerCubicCentimeter);
            TotalVolume         tv  = new TotalVolume(10, VolumeUnits.CubicCentimeters);
            TotalWeight         tw  = new TotalWeight(msg, uww, tv, WeightUnits.Kilograms);

            Assert.AreEqual("W", tw.Symbol);
            Assert.AreEqual(Math.Round(tw.NumericValue, 2), .10);
            Assert.AreEqual(tw.UnitOfMeasure, WeightUnits.Kilograms);
        }
Пример #7
0
        public void Constructor2ShouldStoreAndPrintValueAndSymbol()
        {
            VolumeOfVoids vv            = new VolumeOfVoids(10, VolumeUnits.CubicCentimeters);
            TotalVolume   tv            = new TotalVolume(10, VolumeUnits.CubicCentimeters);
            Porosity      p             = new Porosity(vv, tv);
            String        correctAnswer = "n = 100 %";

            Assert.AreEqual("n", p.Symbol);
            Assert.AreEqual(p.NumericValue, 1);
            Assert.AreEqual(correctAnswer, p.ToString());
        }
        public void Constructor2ShouldStoreAndPrintValueAndSymbolWithFt3()
        {
            VolumeOfVoids       vv  = new VolumeOfVoids(10, VolumeUnits.CubicCentimeters);
            TotalVolume         tv  = new TotalVolume(20, VolumeUnits.CubicCentimeters);
            VolumeOfSolidMatter vsm = new VolumeOfSolidMatter(vv, tv, VolumeUnits.CubicFeet);
            String correctAnswer    = "V_s = 0 ft^3";

            Assert.AreEqual("V_s", vsm.Symbol);
            Assert.AreEqual(Math.Round(vsm.NumericValue, 6), 0.000353);
            Assert.AreEqual(vsm.UnitOfMeasure, VolumeUnits.CubicFeet);
            Assert.AreEqual(correctAnswer, vsm.ToString());
        }
Пример #9
0
        public void Constructor2ShouldStoreAndPrintValueAndSymbolWithM3()
        {
            VolumeOfSolidMatter vsm = new VolumeOfSolidMatter(10, VolumeUnits.CubicCentimeters);
            VolumeOfVoids       vv  = new VolumeOfVoids(10, VolumeUnits.CubicCentimeters);
            TotalVolume         tv  = new TotalVolume(vsm, vv, VolumeUnits.CubicMeters);
            String correctAnswer    = "V = 0 m^3";

            Assert.AreEqual("V", tv.Symbol);
            Assert.AreEqual(tv.NumericValue, 2e-5);
            Assert.AreEqual(tv.UnitOfMeasure, VolumeUnits.CubicMeters);
            Assert.AreEqual(correctAnswer, tv.ToString());
        }
Пример #10
0
        public void Constructor3ShouldStoreAndPrintValueAndSymbolWithCubicCentimeters()
        {
            VolumeOfSolidMatter vsm = new VolumeOfSolidMatter(10, VolumeUnits.CubicCentimeters);
            TotalVolume         tv  = new TotalVolume(20, VolumeUnits.CubicCentimeters);
            VolumeOfVoids       vv  = new VolumeOfVoids(vsm, tv, VolumeUnits.CubicCentimeters);
            String correctAnswer    = "V_v = 10 cc";

            Assert.AreEqual("V_v", vv.Symbol);
            Assert.AreEqual(vv.NumericValue, 10);
            Assert.AreEqual(vv.UnitOfMeasure, VolumeUnits.CubicCentimeters);
            Assert.AreEqual(correctAnswer, vv.ToString());
        }
Пример #11
0
        public void Constructor4ShouldStoreAndPrintValueAndSymbolWithM3()
        {
            Porosity      p             = new Porosity(.1);
            TotalVolume   tv            = new TotalVolume(10, VolumeUnits.CubicCentimeters);
            VolumeOfVoids vv            = new VolumeOfVoids(p, tv, VolumeUnits.CubicMeters);
            String        correctAnswer = "V_v = 0 m^3";

            Assert.AreEqual("V_v", vv.Symbol);
            Assert.AreEqual(Math.Round(vv.NumericValue, 6), 1e-6);
            Assert.AreEqual(vv.UnitOfMeasure, VolumeUnits.CubicMeters);
            Assert.AreEqual(correctAnswer, vv.ToString());
        }
        public virtual int _GetUniqueIdentifier()
        {
            var hashCode = 399326290;

            hashCode = hashCode * -1521134295 + (Id?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Owner?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (DepartureTime?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (CurrentStatus?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Temperature?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (LoadPercentage?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (TotalVolume?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (AverageVolume?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (MaxTravelTime?.GetHashCode() ?? 0);
            return(hashCode);
        }
Пример #13
0
 public string[] GetCells()
 {
     m_cellValues[0]  = Symbol;
     m_cellValues[1]  = LastTradePrice.ToString(this.PriceFormat);
     m_cellValues[2]  = LastTradeSize.ToString();
     m_cellValues[3]  = BidSize.ToString();
     m_cellValues[4]  = Bid.ToString(this.PriceFormat);
     m_cellValues[5]  = Ask.ToString(this.PriceFormat);
     m_cellValues[6]  = AskSize.ToString();
     m_cellValues[7]  = TotalVolume.ToString();
     m_cellValues[8]  = OpenPrice.ToString(this.PriceFormat);
     m_cellValues[9]  = HighPrice.ToString(this.PriceFormat);
     m_cellValues[10] = LowPrice.ToString(this.PriceFormat);
     m_cellValues[11] = ClosePrice.ToString(this.PriceFormat);
     return(m_cellValues);
 }
Пример #14
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hash = 17;
         hash = hash * 29 + Timestamp.GetHashCode();
         hash = hash * 29 + High.GetHashCode();
         hash = hash * 29 + Low.GetHashCode();
         hash = hash * 29 + Close.GetHashCode();
         hash = hash * 29 + Open.GetHashCode();
         hash = hash * 29 + TotalVolume.GetHashCode();
         hash = hash * 29 + PeriodVolume.GetHashCode();
         hash = hash * 29 + NumberOfTrades.GetHashCode();
         return(hash);
     }
 }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Timestamp.GetHashCode();
         hashCode = (hashCode * 397) ^ High.GetHashCode();
         hashCode = (hashCode * 397) ^ Low.GetHashCode();
         hashCode = (hashCode * 397) ^ Open.GetHashCode();
         hashCode = (hashCode * 397) ^ Close.GetHashCode();
         hashCode = (hashCode * 397) ^ TotalVolume.GetHashCode();
         hashCode = (hashCode * 397) ^ PeriodVolume.GetHashCode();
         hashCode = (hashCode * 397) ^ TotalTrade;
         hashCode = (hashCode * 397) ^ PeriodTrade;
         hashCode = (hashCode * 397) ^ VWAP.GetHashCode();
         return(hashCode);
     }
 }
 public override int GetHashCode()
 {
     unchecked
     {
         var hash = 17;
         hash = hash * 29 + Timestamp.GetHashCode();
         hash = hash * 29 + Last.GetHashCode();
         hash = hash * 29 + LastSize.GetHashCode();
         hash = hash * 29 + TotalVolume.GetHashCode();
         hash = hash * 29 + Bid.GetHashCode();
         hash = hash * 29 + Ask.GetHashCode();
         hash = hash * 29 + TickId.GetHashCode();
         hash = hash * 29 + BasisForLast.GetHashCode();
         hash = hash * 29 + TradeMarketCenter.GetHashCode();
         hash = hash * 29 + TradeConditions.GetHashCode();
         return(hash);
     }
 }
Пример #17
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hash = 17;
         hash = hash * 29 + Symbol.GetHashCode();
         hash = hash * 29 + MostRecentTrade.GetHashCode();
         hash = hash * 29 + MostRecentTradeSize.GetHashCode();
         hash = hash * 29 + MostRecentTradeTime.GetHashCode();
         hash = hash * 29 + MostRecentTradeMarketCenter.GetHashCode();
         hash = hash * 29 + TotalVolume.GetHashCode();
         hash = hash * 29 + Bid.GetHashCode();
         hash = hash * 29 + BidSize.GetHashCode();
         hash = hash * 29 + Ask.GetHashCode();
         hash = hash * 29 + AskSize.GetHashCode();
         hash = hash * 29 + Open.GetHashCode();
         hash = hash * 29 + High.GetHashCode();
         hash = hash * 29 + Low.GetHashCode();
         hash = hash * 29 + Close.GetHashCode();
         hash = hash * 29 + MessageContents.GetHashCode();
         hash = hash * 29 + MostRecentTradeConditions.GetHashCode();
         return(hash);
     }
 }
Пример #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VolumeOfVoids"/> class.
 /// </summary>
 /// <param name="solidVolume">V_s in V=V_s+V_v.</param>
 /// <param name="totalVolume">V in V=V_s+V_v.</param>
 /// <param name="units">Measurement units to hold value after initial calculation (ie cc).</param>
 public VolumeOfVoids(VolumeOfSolidMatter solidVolume, TotalVolume totalVolume, VolumeUnits units)
     : this(ConvertToUnits(totalVolume, units).NumericValue - ConvertToUnits(solidVolume, units).NumericValue, units)
 {
 }
Пример #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TotalWeight"/> class.
 /// </summary>
 /// <param name="massSpecificGravity">G_m in W=G_m*gamma_w*V.</param>
 /// <param name="unitWeightOfWater">gamma_w in W=G_m*gamma_w*V.</param>
 /// <param name="totalVolume">V in W=G_m*gamma_w*V.</param>
 /// <param name="units">Measurement unit to hold value after initial calculation (ie kg).</param>
 public TotalWeight(MassSpecificGravity massSpecificGravity, UnitWeightOfWater unitWeightOfWater, TotalVolume totalVolume, WeightUnits units)
     : this(ConvertToUnits(new BaseWeightScalar("𝛾", BaseUnitWeightScalar.ConvertToUnits(unitWeightOfWater, UnitWeightUnits.KilogramPerMeterCubed).NumericValue *BaseVolumeScalar.ConvertToUnits(totalVolume, VolumeUnits.CubicMeters).NumericValue *massSpecificGravity.NumericValue, WeightUnits.Kilograms), units).NumericValue, units)
 {
 }
Пример #20
0
        public Dictionary <string, string> ToStringDict()
        {
            Dictionary <string, string> dict = new Dictionary <string, string>();

            string cropYear;

            if (CropYear == 0)
            {
                cropYear = "0";
            }
            else
            {
                cropYear = CropYear.ToString();
            }
            dict.Add("cropYear", cropYear);

            string crop;

            if (Crop == null)
            {
                crop = string.Empty;
            }
            else
            {
                crop = Crop.ToString();
            }
            dict.Add("crop", crop);

            string grainHeight;

            if (GrainHeight == 0)
            {
                grainHeight = "0";
            }
            else
            {
                grainHeight = GrainHeight.ToString();
            }
            dict.Add("grainHeight", grainHeight);

            string grainHopperHeight;

            if (GrainHopperHeight == 0)
            {
                grainHopperHeight = "0";
            }
            else
            {
                grainHopperHeight = GrainHopperHeight.ToString();
            }
            dict.Add("grainHopperHeight", grainHopperHeight);

            string coneHeight;

            if (ConeHeight == 0)
            {
                coneHeight = "0";
            }
            else
            {
                coneHeight = ConeHeight.ToString();
            }
            dict.Add("coneHeight", coneHeight);

            string totalVolume;

            if (TotalVolume == 0)
            {
                totalVolume = "0";
            }
            else
            {
                totalVolume = TotalVolume.ToString("#,###.##");
            }
            dict.Add("totalVolume", totalVolume);

            string moistureOfGrain;

            if (MoistureOfGrain == 0)
            {
                moistureOfGrain = "0";
            }
            else
            {
                moistureOfGrain = MoistureOfGrain.ToString();
            }
            dict.Add("moistureOfGrain", moistureOfGrain);

            string moistureFactor;

            if (MoistureFactor == 0)
            {
                moistureFactor = "0";
            }
            else
            {
                moistureFactor = MoistureFactor.ToString();
            }
            dict.Add("moistureFactor", moistureFactor);

            string testWeight;

            if (TestWeight == 0)
            {
                testWeight = "0";
            }
            else
            {
                testWeight = TestWeight.ToString();
            }
            dict.Add("testWeight", testWeight);

            string packFactor;

            if (PackFactor == 0)
            {
                packFactor = "0";
            }
            else
            {
                packFactor = PackFactor.ToString();
            }
            dict.Add("packFactor", packFactor);

            string dockagePercent;

            if (DockagePercent == 0)
            {
                dockagePercent = "0";
            }
            else
            {
                dockagePercent = DockagePercent.ToString();
            }
            dict.Add("dockagePercent", dockagePercent);

            string dockageFactor;

            if (DockageFactor == 0)
            {
                dockageFactor = "0";
            }
            else
            {
                dockageFactor = DockageFactor.ToString();
            }
            dict.Add("dockageFactor", dockageFactor);

            string conversionFactor;

            if (ConversionFactor == 0)
            {
                conversionFactor = "0";
            }
            else
            {
                conversionFactor = ConversionFactor.ToString();
            }
            dict.Add("conversionFactor", conversionFactor);

            string shellFactor;

            if (ShellFactor == 0)
            {
                shellFactor = "0";
            }
            else
            {
                shellFactor = ShellFactor.ToString();
            }
            dict.Add("shellFactor", shellFactor);

            string totalDeductionVolume;

            if (TotalDeductionVolume == 0)
            {
                totalDeductionVolume = "0";
            }
            else
            {
                totalDeductionVolume = TotalDeductionVolume.ToString();
            }
            dict.Add("totalDeductionVolume", totalDeductionVolume);

            string notes;

            if (Notes == null)
            {
                notes = string.Empty;
            }
            else
            {
                notes = Notes.ToString();
            }
            dict.Add("notes", notes);

            return(dict);
        }
Пример #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TotalUnitWeight"/> class.
 /// </summary>
 /// <param name="totalWeight">W in gamma_t=W/V.</param>
 /// <param name="totalVolume">V in gamma_t=W/V.</param>
 /// <param name="units">Measurement unit to use after construction from formula (ie g/cc).</param>
 public TotalUnitWeight(TotalWeight totalWeight, TotalVolume totalVolume, UnitWeightUnits units)
     : this(ConvertToUnits(new BaseUnitWeightScalar("𝛾", BaseWeightScalar.ConvertToUnits(totalWeight, WeightUnits.Kilograms).NumericValue / BaseVolumeScalar.ConvertToUnits(totalVolume, VolumeUnits.CubicMeters).NumericValue, UnitWeightUnits.KilogramPerMeterCubed), units).NumericValue, units)
 {
 }
Пример #22
0
        public List <string> ToStringList()
        {
            List <string> list = new List <string>();

            string cropYear;

            if (CropYear == 0)
            {
                cropYear = "0";
            }
            else
            {
                cropYear = CropYear.ToString();
            }
            list.Add("CropYear: " + cropYear);

            string crop;

            if (Crop == null)
            {
                crop = string.Empty;
            }
            else
            {
                crop = Crop.ToString();
            }
            list.Add("Crop: " + crop);

            string grainHeight;

            if (GrainHeight == 0)
            {
                grainHeight = "0";
            }
            else
            {
                grainHeight = GrainHeight.ToString();
            }
            list.Add("Grain Height: " + grainHeight);

            string hopperHeight;

            if (GrainHopperHeight == 0)
            {
                hopperHeight = "0";
            }
            else
            {
                hopperHeight = GrainHopperHeight.ToString();
            }
            list.Add("Grain Hopper Height: " + hopperHeight.ToString());

            string coneHeight;

            if (ConeHeight == 0)
            {
                coneHeight = "0";
            }
            else
            {
                coneHeight = ConeHeight.ToString();
            }
            list.Add("Cone Height: " + coneHeight);

            string totalVolume;

            if (TotalVolume == 0)
            {
                totalVolume = "0";
            }
            else
            {
                totalVolume = TotalVolume.ToString("#,###.##");
            }
            list.Add("Total Volume: " + totalVolume);

            string moistureOfGrain;

            if (MoistureOfGrain == 0)
            {
                moistureOfGrain = "0";
            }
            else
            {
                moistureOfGrain = MoistureOfGrain.ToString();
            }
            list.Add("Moisture Of Grain: " + moistureOfGrain);

            string moistureFactor;

            if (MoistureFactor == 0)
            {
                moistureFactor = "0";
            }
            else
            {
                moistureFactor = MoistureFactor.ToString();
            }
            list.Add("Moisture Factor: " + moistureFactor);

            string testWeight;

            if (TestWeight == 0)
            {
                testWeight = "0";
            }
            else
            {
                testWeight = TestWeight.ToString();
            }
            list.Add("Test Weight: " + testWeight);

            string packFactor;

            if (PackFactor == 0)
            {
                packFactor = "0";
            }
            else
            {
                packFactor = PackFactor.ToString();
            }
            list.Add("Pack Factor: " + packFactor);

            string dockagePercent;

            if (DockagePercent == 0)
            {
                dockagePercent = "0";
            }
            else
            {
                dockagePercent = DockagePercent.ToString();
            }
            list.Add("Dockage Percent: " + dockagePercent);

            string dockageFactor;

            if (DockageFactor == 0)
            {
                dockageFactor = "0";
            }
            else
            {
                dockageFactor = DockageFactor.ToString();
            }
            list.Add("Dockage Factor: " + dockageFactor);

            string conversionFactor;

            if (ConversionFactor == 0)
            {
                conversionFactor = "0";
            }
            else
            {
                conversionFactor = ConversionFactor.ToString();
            }
            list.Add("Conversion Factor: " + conversionFactor);

            string shellFactor;

            if (ShellFactor == 0)
            {
                shellFactor = "0";
            }
            else
            {
                shellFactor = ShellFactor.ToString();
            }
            list.Add("Shell Factor: " + shellFactor);

            string totalDeductionVolume;

            if (TotalDeductionVolume == 0)
            {
                totalDeductionVolume = "0";
            }
            else
            {
                totalDeductionVolume = TotalDeductionVolume.ToString();
            }
            list.Add("Total Deduction Volume: " + totalDeductionVolume);

            string notes;

            if (Notes == null)
            {
                notes = string.Empty;
            }
            else
            {
                notes = Notes.ToString();
            }
            list.Add("Notes: " + notes);

            return(list);
        }
Пример #23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VolumeOfVoids"/> class.
 /// </summary>
 /// <param name="porosity">n in n=V_v/V.</param>
 /// <param name="totalVolume">V in n=V_v/V.</param>
 /// <param name="units">Measurement units to hold value after initial calculation (ie cc).</param>
 public VolumeOfVoids(Porosity porosity, TotalVolume totalVolume, VolumeUnits units)
     : this(BaseVolumeScalar.ConvertToUnits(totalVolume, units).NumericValue *porosity.NumericValue, units)
 {
 }