本文整理汇总了C#中ITime类的典型用法代码示例。如果您正苦于以下问题:C# ITime类的具体用法?C# ITime怎么用?C# ITime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITime类属于命名空间,在下文中一共展示了ITime类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: IsBefore
/// <summary>
/// return true if ta is before tb (eveluates (ta less than tb)
/// </summary>
/// <param name="ta">Time ta</param>
/// <param name="tb">time tb</param>
/// <returns>true if ta is before tb (eveluates (ta less than tb)</returns>
public static bool IsBefore(ITime ta, ITime tb)
{
double a;
double b;
bool isTaBeforeTb;
if (ta is ITimeSpan)
{
a = ((ITimeSpan) ta).End.ModifiedJulianDay;
}
else
{
a = ((ITimeStamp) ta).ModifiedJulianDay;
}
if (tb is ITimeSpan)
{
b = ((ITimeSpan) tb).Start.ModifiedJulianDay;
}
else
{
b = ((ITimeStamp) tb).ModifiedJulianDay;
}
isTaBeforeTb = (a < b);
return isTaBeforeTb;
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:33,代码来源:Support.cs
示例2: HttpClient
public HttpClient(IConnectionManager connectionManager, IWebRequest webRequest,
IReynaLogger logger, ITime time)
{
this.ConnectionManager = connectionManager;
_webRequest = webRequest;
_logger = logger;
_time = time;
}
开发者ID:B2MSolutions,项目名称:reyna-net45,代码行数:8,代码来源:HttpClient.cs
示例3: ScreenBlock
public ScreenBlock(ITime time)
{
InitializeComponent();
Icon = Properties.Resources.Sleeping_2;
_time = time;
_lastValue = 5;
debug.DataBindings.Add("Text", this, "Debug");
}
开发者ID:rlarno,项目名称:DayTimer,代码行数:9,代码来源:ScreenBlock.cs
示例4: Time
public Time(ITime time)
: this()
{
if(time != null)
{
_Time = time;
_Request.Reset();
_Time.GetTick().OnValue += _Timing;
}
}
开发者ID:jiowchern,项目名称:Regulus,代码行数:10,代码来源:Time.cs
示例5: GetValues
public override IValueSet GetValues(ITime time, string linkID)
{
int timesCount = ((SmartOutputLink)this.SmartOutputLinks[0]).SmartBuffer.TimesCount;
if (timesCount > _maxBufferSize)
{
_maxBufferSize = timesCount;
}
return base.GetValues(time, linkID);
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:11,代码来源:RiverModelLC.cs
示例6: ElasticSearchDbLogger
public ElasticSearchDbLogger(ITime time)
{
_time = time;
var host = Environment.GetEnvironmentVariable("ElasticSearchHost");
if (string.IsNullOrEmpty(host))
{
throw new ConfigurationErrorsException(@"Please define an environment variable of ElasticSearchHost with the hostname of your ES server.");
}
_connection = new ElasticConnection(host);
_serializer = new JsonNetSerializer();
}
开发者ID:naeemkhedarun,项目名称:nosey,代码行数:13,代码来源:IDbLogger.cs
示例7: DoValidation
public override bool DoValidation(ITime getValuesAt)
{
try
{
foreach (var v in _component.Validate())
ProcessValidateMessage(v);
if (_component.Status == LinkableComponentStatus.Invalid)
AddError = "Status == LinkableComponentStatus.Invalid";
int nProviders = _component.Inputs.Aggregate(0, (sum, o) => o.Provider == null ? sum : sum + 1);
int nConsumers = _component.Outputs.Aggregate(0, (sum, o) => sum + o.Consumers.Count);
AddDetail = string.Format("Provider count: {0}", nProviders);
AddDetail = string.Format("Consumer count: {0}", nConsumers);
if (_component is ITimeSpaceComponent)
{
if (getValuesAt == null)
AddWarning = "Cannot validate TimeHorizon as composition time not provided";
else
{
var extent = ((ITimeSpaceComponent)_component).TimeExtent;
if (double.IsInfinity(extent.TimeHorizon.StampAsModifiedJulianDay))
AddError = "Invalid/Unspecified TimeHorizon " + extent.TimeHorizon.ToString();
else
{
if (extent.TimeHorizon.StampAsModifiedJulianDay > getValuesAt.StampAsModifiedJulianDay)
AddError = "Component time horizon does not start until after requested composition run time.";
if (!double.IsInfinity(extent.TimeHorizon.DurationInDays))
{
var end = extent.TimeHorizon.StampAsModifiedJulianDay + extent.TimeHorizon.DurationInDays;
if (end < getValuesAt.StampAsModifiedJulianDay)
AddWarning = "Time horizon ends before end of composition run time.";
}
}
}
}
}
catch (System.Exception e)
{
AddError = Sdk.Utilities.Xml.Persist(e).ToString();
}
return _errors.Count == 0;
}
开发者ID:CNH-Hyper-Extractive,项目名称:parallel-sdk,代码行数:49,代码来源:ValidationComponent.cs
示例8: RunParallel
public void RunParallel(ITime triggerTime, ParallelizeMode mode)
{
Event theEvent = new Event(EventType.Informative);
theEvent.Description = "Parallel execution feature enabled, with " + mode + " mode.";
_runListener.OnEvent(theEvent);
switch (mode)
{
case ParallelizeMode.Standard:
runStandardParallel(triggerTime);
break;
case ParallelizeMode.Aggressive:
runAggressiveParallel(triggerTime);
break;
}
}
开发者ID:KangChaofan,项目名称:OOC,代码行数:15,代码来源:CompositionRunner.cs
示例9: DoValidation
public override bool DoValidation(ITime getValuesAt)
{
try
{
if (_adapter.Adaptee == null)
AddError = "Source has Adaptee unspecified";
if (_adapter.Consumers.Count == 0 && _adapter.AdaptedOutputs.Count == 0)
AddError = "Adapter unattached, has no consumers or adapters";
}
catch (System.Exception e)
{
AddError = Sdk.Utilities.Xml.Persist(e).ToString();
}
return _errors.Count == 0;
}
开发者ID:CNH-Hyper-Extractive,项目名称:parallel-sdk,代码行数:17,代码来源:ValidationOutput.cs
示例10: DoValidation
public override bool DoValidation(ITime getValuesAt)
{
try
{
if (_options.RunType != RunType.GetValuesAt)
AddError = "Not a GetValuesAt run";
if (_options.GetValuesAt_ActOn == null)
AddError = "No output specified to pull values on, need to set in composition View tab";
if (_options.GetValuesAt_RunTo == null
|| double.IsInfinity(_options.GetValuesAt_RunTo.StampAsModifiedJulianDay))
AddError = "Invalid time specified to pull values too";
}
catch (System.Exception e)
{
AddError = Sdk.Utilities.Xml.Persist(e).ToString();
}
return _errors.Count == 0;
}
开发者ID:CNH-Hyper-Extractive,项目名称:parallel-sdk,代码行数:21,代码来源:ValidationRunOptions.cs
示例11: RunSequence
public void RunSequence(ITime triggerTime)
{
Event theEvent = new Event(EventType.Informative);
theEvent.Description = "Parallel execution feature disabled.";
_runListener.OnEvent(theEvent);
/* try find edge model and trigger them first, is possible */
int edgeModel = 0;
foreach (Model uimodel in _models)
{
if (!isModelEngineComponent(uimodel.LinkableComponent)) continue;
int outDegree = 0;
LinkableRunEngine runEngine = (LinkableRunEngine)uimodel.LinkableComponent;
foreach (ILink link in runEngine.GetProvidingLinks())
{
if (isModelEngineComponent(link.TargetComponent))
outDegree++;
}
theEvent = new Event(EventType.Informative);
theEvent.Description = "Out degree of " + uimodel.ModelID + " is " + outDegree + ".";
_runListener.OnEvent(theEvent);
if (outDegree == 0)
{
runEngine.RunToTime(triggerTime, -1);
edgeModel++;
}
}
/* no edge model was found, perhaps the composition is combined with circles */
if (edgeModel == 0)
{
theEvent = new Event(EventType.Informative);
theEvent.Description = "No edge model found, try invoke all of them.";
_runListener.OnEvent(theEvent);
foreach (Model uimodel in _models)
{
if (!isModelEngineComponent(uimodel.LinkableComponent)) continue;
LinkableRunEngine runEngine = (LinkableRunEngine)uimodel.LinkableComponent;
runEngine.RunToTime(triggerTime, -1);
}
}
}
开发者ID:KangChaofan,项目名称:OOC,代码行数:40,代码来源:CompositionRunner.cs
示例12: MapFromTimeStampsToTimeSpan
/// <summary>
/// A ValueSet corresponding to a TimeSpan is calculated using interpolation or
/// extrapolation in corresponding lists of ValueSets and TimeStamps.
/// </summary>
/// <param name="requestedTime">Time for which the ValueSet is requested</param>
/// <returns>ValueSet that corresponds to requestedTime</returns>
private List<double> MapFromTimeStampsToTimeSpan(ITime requestedTime)
{
try
{
int m = _values[0].Length;
//int N = times.Count; // Number of time steps in buffer
double[][] xr = new double[m][]; // Values to return
double trb = requestedTime.StampAsModifiedJulianDay; // Begin time in requester time interval
double tre = requestedTime.StampAsModifiedJulianDay + requestedTime.DurationInDays; // End time in requester time interval
const int nk = 1;
for (int i = 0; i < m; i++)
{
xr[i] = new double[nk];
}
for (int i = 0; i < m; i++)
{
for (int k = 0; k < nk; k++)
{
xr[i][k] = 0;
}
}
for (int n = 0; n < _times.Count - 1; n++)
{
double tbn = _times[n].StampAsModifiedJulianDay;
double tbnp1 = _times[n + 1].StampAsModifiedJulianDay;
//---------------------------------------------------------------------------
// B: <-------------------------->
// R: <------------------------------------->
// --------------------------------------------------------------------------
if (trb <= tbn && tre >= tbnp1)
{
for (int k = 1; k <= nk; k++)
{
for (int i = 0; i < m; i++) // for all values coorsponding to the same time interval
{
double sbin = BufferHelper.GetVal(_values[n], i, k);
double sbinp1 = BufferHelper.GetVal(_values[n + 1], i, k);
xr[i][k - 1] += 0.5 * (sbin + sbinp1) * (tbnp1 - tbn) / (tre - trb);
}
}
}
//---------------------------------------------------------------------------
// Times[i] Interval: t1|-----------------------|t2
// Requested Interval: rt1|--------------|rt2
// --------------------------------------------------------------------------
else if (tbn <= trb && tre <= tbnp1) //cover all
{
for (int k = 1; k <= nk; k++)
{
for (int i = 0; i < m; i++) // for all values coorsponding to the same time interval
{
double sbin = BufferHelper.GetVal(_values[n], i, k);
double sbinp1 = BufferHelper.GetVal(_values[n + 1], i, k);
xr[i][k - 1] += sbin + ((sbinp1 - sbin) / (tbnp1 - tbn)) * ((tre + trb) / 2 - tbn);
}
}
}
//---------------------------------------------------------------------------
// Times[i] Interval: t1|-----------------|t2
// Requested Interval: rt1|--------------|rt2
// --------------------------------------------------------------------------
else if (tbn < trb && trb < tbnp1 && tre > tbnp1)
{
for (int k = 1; k <= nk; k++)
{
for (int i = 0; i < m; i++) // for all values coorsponding to the same time interval
{
double sbin = BufferHelper.GetVal(_values[n], i, k);
double sbinp1 = BufferHelper.GetVal(_values[n + 1], i, k);
xr[i][k - 1] += (sbinp1 - (sbinp1 - sbin) / (tbnp1 - tbn) * ((tbnp1 - trb) / 2)) * (tbnp1 - trb) / (tre - trb);
}
}
}
//---------------------------------------------------------------------------
// Times[i] Interval: t1|-----------------|t2
// Requested Interval: rt1|--------------|rt2
// --------------------------------------------------------------------------
else if (trb < tbn && tre > tbn && tre < tbnp1)
{
for (int k = 1; k <= nk; k++)
{
for (int i = 0; i < m; i++) // for all values coorsponding to the same time interval
{
double sbin = BufferHelper.GetVal(_values[n], i, k);
//.........这里部分代码省略.........
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:101,代码来源:SmartBuffer.cs
示例13: scheduleAggressive
private void scheduleAggressive(ITime triggerTime)
{
List<List<Model>> orders;
lock (this)
{
orders = getTopologicalOrder(_queueModels);
}
if (orders.Count > 0)
{
List<Model> tier = orders[0];
foreach (Model model in tier)
{
if (!isModelEngineComponent(model.LinkableComponent)) continue;
lock (this)
{
if (_runningModels.Contains(model)) continue;
_runningModels.Add(model);
}
Event theEvent = new Event(EventType.Informative);
theEvent.Description = "Triggering model: " + model.ModelID;
_runListener.OnEvent(theEvent);
LinkableRunEngine runEngine = (LinkableRunEngine)model.LinkableComponent;
new Thread(new ThreadStart(delegate()
{
runEngine.RunToTime(triggerTime, -1);
lock (this)
{
_runningModels.Remove(model);
_queueModels.Remove(model);
}
_s.Release();
})).Start();
}
}
}
开发者ID:KangChaofan,项目名称:OOC,代码行数:35,代码来源:CompositionRunner.cs
示例14: GetValues
/// <summary>
/// Returns the ValueSet that corresponds to requestTime. The ValueSet may be found by
/// interpolation, extrapolation and/or aggregation.
/// </summary>
/// <param name="requestedTime">time for which the value is requested</param>
/// <returns>valueSet that corresponds to requestTime</returns>
public List<double> GetValues(ITime requestedTime)
{
if (_doExtendedDataVerification)
{
CheckBuffer();
}
if (!_doExtrapolateAtEnd)
{
if (requestedTime.StampAsModifiedJulianDay + requestedTime.DurationInDays >
_times[_times.Count - 1].StampAsModifiedJulianDay + _times[_times.Count - 1].DurationInDays)
{
throw new Exception("Extrapolation after last time step not allowed for this buffer");
}
}
List<double> returnValues = new List<double>(); ;
if (_values.Values2DArray.Count != 0)
{
if (_times[0].DurationInDays > 0 && requestedTime.DurationInDays > 0)
{
returnValues = MapFromTimeSpansToTimeSpan(requestedTime);
}
else if (_times[0].DurationInDays > 0 && requestedTime.DurationInDays == 0)
{
returnValues = MapFromTimeSpansToTimeStamp(requestedTime);
}
else if (_times[0].DurationInDays == 0 && requestedTime.DurationInDays > 0)
{
returnValues = MapFromTimeStampsToTimeSpan(requestedTime);
}
else // time stamps
{
returnValues = MapFromTimeStampsToTimeStamp(requestedTime);
}
}
// Console.WriteLine(((requestedTime.DurationInDays > 0) ? "Span" : "Stamp") + " from " +
// ((times[0].DurationInDays > 0) ? "Span" : "Stamp") + " in Buffer: " + requestedTime + ": "
// + returnValueSet[0]);
return returnValues;
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:47,代码来源:SmartBuffer.cs
示例15: runAggressiveParallel
private void runAggressiveParallel(ITime triggerTime)
{
_s = new Semaphore(0, _models.Count);
_queueModels = new List<Model>(_models);
_runningModels = new List<Model>();
while (_queueModels.Count > 0 && _s.WaitOne())
{
scheduleAggressive(triggerTime);
}
}
开发者ID:KangChaofan,项目名称:OOC,代码行数:10,代码来源:CompositionRunner.cs
示例16: runStandardParallel
private void runStandardParallel(ITime triggerTime)
{
List<Thread> threads = new List<Thread>();
List<Model> uimodels = new List<Model>(_models);
List<List<Model>> orders;
while ((orders = getTopologicalOrder(uimodels)).Count > 0)
{
List<Model> tier = orders[0];
string modelIds = "";
foreach (Model uimodel in tier) modelIds += uimodel.ModelID + ", ";
Event theEvent = new Event(EventType.Informative);
theEvent.Description = "Tier models: " + modelIds;
_runListener.OnEvent(theEvent);
foreach (Model uimodel in tier)
{
if (!isModelEngineComponent(uimodel.LinkableComponent)) continue;
LinkableRunEngine runEngine = (LinkableRunEngine)uimodel.LinkableComponent;
Thread th = new Thread(new ThreadStart(delegate()
{
runEngine.RunToTime(triggerTime, -1);
}));
th.Start();
threads.Add(th);
uimodels.Remove(uimodel);
}
foreach (Thread th in threads)
{
th.Join();
}
threads.Clear();
}
}
开发者ID:KangChaofan,项目名称:OOC,代码行数:32,代码来源:CompositionRunner.cs
示例17: GetValues
public IValueSet GetValues(ITime time, string linkID)
{
// TODO: Add Trigger.GetValues implementation
return null;
}
开发者ID:JauchOnGitHub,项目名称:mohid.codeplex,代码行数:5,代码来源:Trigger.cs
示例18: MapFromTimeSpansToTimeSpan
/// <summary>
/// A ValueSet corresponding to a TimeSpan is calculated using interpolation or
/// extrapolation in corresponding lists of ValueSets and TimeSpans.
/// </summary>
/// <param name="requestedTime">Time for which the ValueSet is requested</param>
/// <returns>ValueSet that corresponds to requestedTime</returns>
private List<double> MapFromTimeSpansToTimeSpan(ITime requestedTime)
{
try
{
int m = _values[0].Length;
double[][] xr = new double[m][]; // Values to return
double trb = requestedTime.StampAsModifiedJulianDay; // Begin time in requester time interval
double tre = requestedTime.StampAsModifiedJulianDay + requestedTime.DurationInDays; // End time in requester time interval
const int nk = 1;
for (int i = 0; i < m; i++)
{
xr[i] = new double[nk];
}
for (int i = 0; i < m; i++)
{
for (int k = 0; k < nk; k++)
{
xr[i][k] = 0;
}
}
for (int n = 0; n < _times.Count; n++)
{
double tbbn = _times[n].StampAsModifiedJulianDay;
double tben = _times[n].StampAsModifiedJulianDay + _times[n].DurationInDays;
//---------------------------------------------------------------------------
// B: <-------------------------->
// R: <------------------------------------->
// --------------------------------------------------------------------------
if (trb <= tbbn && tre >= tben) //Buffered TimeSpan fully included in requested TimeSpan
{
for (int k = 1; k <= nk; k++)
{
for (int i = 0; i < m; i++) // for all values coorsponding to the same time interval
{
double sbin = BufferHelper.GetVal(_values[n], i, k);
xr[i][k - 1] += sbin * (tben - tbbn) / (tre - trb);
}
}
}
//---------------------------------------------------------------------------
// Times[i] Interval: t1|-----------------------|t2
// Requested Interval: rt1|--------------|rt2
// --------------------------------------------------------------------------
else if (tbbn <= trb && tre <= tben) //cover all
{
for (int k = 1; k <= nk; k++)
{
for (int i = 0; i < m; i++) // for all values coorsponding to the same time interval
{
xr[i][k - 1] += BufferHelper.GetVal(_values[n], i, k);
}
}
}
//---------------------------------------------------------------------------
// Times[i] Interval: t1|-----------------|t2
// Requested Interval: rt1|--------------|rt2
// --------------------------------------------------------------------------
else if (tbbn < trb && trb < tben && tre > tben)
{
for (int k = 1; k <= nk; k++)
{
for (int i = 0; i < m; i++) // for all values coorsponding to the same time interval
{
double sbin = BufferHelper.GetVal(_values[n], i, k);
xr[i][k - 1] += sbin * (tben - trb) / (tben - tbbn);
if (n == _times.Count - 1) // extrapolation needed
{
xr[i][k - 1] += sbin * (tre - tben) / (tben - tbbn);
}
}
}
}
//---------------------------------------------------------------------------
// Times[i] Interval: t1|-----------------|t2
// Requested Interval: rt1|--------------|rt2
// --------------------------------------------------------------------------
else if (trb < tbbn && tre > tbbn && tre < tben)
{
for (int k = 1; k <= nk; k++)
{
for (int i = 0; i < m; i++) // for all values coorsponding to the same time interval
{
double sbin = BufferHelper.GetVal(_values[n], i, k);
xr[i][k - 1] += sbin * (tre - tbbn) / (tben - tbbn);
//.........这里部分代码省略.........
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:101,代码来源:SmartBuffer.cs
示例19: AccelerationBase
/// <summary>
///
/// </summary>
/// <param name="length"></param>
/// <param name="perSquareTime"></param>
protected AccelerationBase(ILength length, ITime perSquareTime)
: base(length, perSquareTime)
{
VerifyDimensions();
}
开发者ID:mwpowellhtx,项目名称:clockworks,代码行数:10,代码来源:AccelerationBase.cs
示例20: IntervalBasedCallback
public IntervalBasedCallback(IGameObject obj, ITime time)
: base(obj)
{
this.time = time;
}
开发者ID:ZackGill,项目名称:Uniject,代码行数:5,代码来源:IntervalBasedCallback.cs
注:本文中的ITime类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论