本文整理汇总了C#中Frequency类的典型用法代码示例。如果您正苦于以下问题:C# Frequency类的具体用法?C# Frequency怎么用?C# Frequency使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Frequency类属于命名空间,在下文中一共展示了Frequency类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ImpliedRate
public static InterestRate ImpliedRate(IDayCounter dc, double compoundFactor, Compounding c, Frequency f, double time)
{
double r;
if (Helper.Equals(compoundFactor, 1.0))
{
r = 0.0;
}
else
{
switch (c)
{
case Compounding.Simple:
r = (compoundFactor - 1.0)/time;
break;
case Compounding.Compounded:
r = (Math.Pow(compoundFactor, 1.0 / ((double)f * time)) - 1.0) * (double)f;
break;
case Compounding.Continuous:
r = Math.Log(compoundFactor)/time;
break;
default:
throw new NotImplementedException($"Unknown Compounding {c}");
}
}
return new InterestRate(dc, r, c, f);
}
示例2: FetchConfigurationForCustomCommand
public FetchConfigurationForCustomCommand(IntegrationAction action, IntegrationType type, Frequency frequency, string customDay)
{
Type = type;
Action = action;
Frequency = frequency;
CustomDay = customDay;
}
示例3: inflationPeriod
//! utility function giving the inflation period for a given date
public static KeyValuePair<Date, Date> inflationPeriod(Date d, Frequency frequency) {
Month month = (Month)d.Month;
int year = d.Year;
Month startMonth;
Month endMonth;
switch (frequency) {
case Frequency.Annual:
startMonth = Month.January;
endMonth = Month.December;
break;
case Frequency.Semiannual:
startMonth = (Month)(6 * ((int)month - 1) / 6 + 1);
endMonth = (Month)(startMonth + 5);
break;
case Frequency.Quarterly:
startMonth = (Month)(3 * ((int)month - 1) / 3 + 1);
endMonth = (Month)(startMonth + 2);
break;
case Frequency.Monthly:
startMonth = endMonth = month;
break;
default:
throw new ApplicationException("Frequency not handled: " + frequency);
}
Date startDate = new Date(1, startMonth, year);
Date endDate = Date.endOfMonth(new Date(1, endMonth, year));
return new KeyValuePair<Date, Date>(startDate, endDate);
}
示例4: FlatForward
public FlatForward(Date referenceDate, double forward, DayCounter dayCounter, Compounding compounding, Frequency frequency)
: base(referenceDate, new Calendar(), dayCounter)
{
forward_ = new SimpleQuote(forward);
compounding_ = compounding;
frequency_ = frequency;
}
示例5: EquivalentRate
public InterestRate EquivalentRate(IDayCounter dc, Compounding c, Frequency f, DateTimeOffset d1, DateTimeOffset d2)
{
var t1 = _dc.YearFraction(d1, d2);
var t2 = dc.YearFraction(d1, d2);
var compoundFactor = CompoundFactor(t1);
return ImpliedRate(dc, compoundFactor, c, f, t2);
}
示例6: SwapRateHelper
public SwapRateHelper(double rate, Period tenor, Calendar calendar,
Frequency fixedFrequency, BusinessDayConvention fixedConvention, DayCounter fixedDayCount,
IborIndex iborIndex)
: this(rate, tenor, calendar, fixedFrequency, fixedConvention, fixedDayCount, iborIndex,
new Handle<Quote>(), new Period(0, TimeUnit.Days))
{
}
示例7: InterestRate
public InterestRate(IDayCounter dc, double r, Compounding c, Frequency f)
{
_dc = dc;
_r = r;
_c = c;
_f = f;
}
示例8: UserPreferenceBuilder
internal UserPreferenceBuilder()
{
userId = Constants.USER_InValidId;
portalId = Constants.PORTAL_ValidPortalId;
messagesEmailFrequency = Frequency.Instant;
notificationsEmailFrequency = Frequency.Hourly;
}
示例9: VerifyAllEnums
public void VerifyAllEnums()
{
var acceleration = new Acceleration(1, AccelerationUnit.BaseUnit);
var angle = new Angle(1, AngleUnit.BaseUnit);
var angularAcceleration = new AngularAcceleration(1, AngularAccelerationUnit.BaseUnit);
var area = new Area(1, AreaUnit.BaseUnit);
var density = new MassDensity(1, MassDensityUnit.BaseUnit);
var electricCurrent = new ElectricCurrent(1, ElectricCurrentUnit.BaseUnit);
var electricResistance = new ElectricResistance(1, ElectricResistanceUnit.BaseUnit);
var electricVoltage = new ElectricPotential(1, ElectricPotentialUnit.BaseUnit);
var energy = new Energy(1, EnergyUnit.BaseUnit);
var force = new Force(1, ForceUnit.BaseUnit);
var frequency = new Frequency(1, FrequencyUnit.BaseUnit);
var jerk = new Jerk(1, JerkUnit.BaseUnit);
var length = new Length(1, LengthUnit.BaseUnit);
var mass = new Mass(1, MassUnit.BaseUnit);
var massFlowRate = new MassFlowRate(1, MassFlowRateUnit.BaseUnit);
var momentum = new Momentum(1, MomentumUnit.BaseUnit);
var numeric = new Numeric(1, NumericUnit.BaseUnit);
var power = new Power(1, PowerUnit.BaseUnit);
var pressure = new Pressure(1, PressureUnit.BaseUnit);
var speed = new Speed(1, SpeedUnit.BaseUnit);
var temperature = new Temperature(1, TemperatureUnit.BaseUnit);
var time = new Time(1, TimeUnit.BaseUnit);
var torque = new Torque(1, TorqueUnit.BaseUnit);
var volume = new Volume(1, VolumeUnit.BaseUnit);
var volumetricFlowRate = new VolumetricFlowRate(1, VolumetricFlowRateUnit.BaseUnit);
}
示例10: Result
public Result(Age a, Sex s, Profession p, Education e, YesNo cit,
List<Technology> tech, Frequency pub, Frequency home,
NumPass single, List<PassType> passType, Frequency pChange,
YesNo sharePass,YesNo pSecure, YesNo passHome,YesNo pMobile,
YesNo hWifiPass, YesNo hWifiFire, YesNo hVirusSoftware, YesNo softUpdate,
SecureLevel sLevel, SharePersonalInfo postPersonal, Frequency pWifi)
{
m_age = a;
m_sex = s;
m_profession = p;
m_education = e;
m_usCitizen = cit;
m_technologyList = tech;
m_publicComputer = pub;
m_homeComputer = home;
m_singlePass = single;
m_passType = passType;
m_passChangeFreq = pChange;
m_sharePassword = sharePass;
m_passSecure = pSecure;
m_passHomePC = passHome;
m_passForMobile = pMobile;
m_homeWifiPass = hWifiPass;
m_homeWifiFirewall = hWifiFire;
m_homeVirusSoftware = hVirusSoftware;
m_softwareUpdates = softUpdate;
m_securityLevel = sLevel;
m_postPersonalInfo = postPersonal;
m_publicWifi = pWifi;
}
示例11: GetRealDevice
private IPwmDevice GetRealDevice()
{
PwmFrequency = new Frequency(60);
DeviceAddress = 0x40;
try
{
Log.Info("Creating pins");
var sdaPin = SdaPin.ToProcessor();
var sclPin = SclPin.ToProcessor();
Log.Info("Creating i2cDriver");
_i2cDriver = new I2cDriver(sdaPin, sclPin);
}
catch (Exception e)
{
Log.Error("Failed to initialise i2c driver. Did you forget sudo?", e);
}
Log.Info("Creating real device...");
var device = new Pca9685Connection(_i2cDriver.Connect(DeviceAddress));
Log.Info("Setting frequency...");
device.SetPwmUpdateRate(PwmFrequency); // # Set frequency to 60 Hz
IsConnected = true;
return device;
}
示例12: Magazine
public Magazine(string name, Frequency issueFrequency, DateTime issueDate, int circulation)
{
_name = name;
_issueFrequency = issueFrequency;
_issueDate = issueDate;
_circulation = circulation;
_articles = new List<Article>();
}
示例13: FetchConfigurationForClientCommand
public FetchConfigurationForClientCommand(IntegrationAction action, IntegrationType type, Frequency frequency, Guid contractId, Guid packageId)
{
Type = type;
Action = action;
Frequency = frequency;
ContractId = contractId;
PackageId = packageId;
}
示例14: OpAddition
public void OpAddition()
{
var frequency1 = new Frequency(1, FrequencyUnit.Hertz);
var frequency2 = new Frequency(1, FrequencyUnit.CyclePerSecond);
var expected = new Frequency(2, FrequencyUnit.Hertz);
(frequency1 + frequency2).ShouldEqual(expected);
(frequency2 + frequency1).ShouldEqual(expected);
}
示例15: Frequency_ToUnit_Then_ResultShouldBeExpected
public void Frequency_ToUnit_Then_ResultShouldBeExpected(double value, double expected)
{
var testee = new Frequency(4, x => x.Mega.Hertz);
var result = testee.ToUnit(x => x.Hertz);
result.Should().Be(4000000, "Hz", UnitFormat.Default);
}