scrollbar |
---|
Summary
It will be useful to have Value as a property in the IExchangeItem which can be set, get. Currently the only way to get value is to call GetValues(ITime time, string linkID) from ILinkableComponent.
This issues was also addressed by Steven (HEC).
How to address in Version 1
Not required.
How to address in Version 2
Code Block |
---|
h2. Summary It will be useful to have Value as a property in the IExchangeItem which can be set, get. Currently the only way to get value is to call *GetValues(ITime time, string linkID)* from ILinkableComponent. This issues was also addressed by Steven (HEC). h2. How to address in Version 1 Not required. h2. How to address in Version 2 {code} interface IExchangeItem { object Value { get; set; } } {code} |
Advantages:
...
- It
...
- will
...
- be
...
- possible
...
- to
...
- get/set
...
- values
...
- directly
...
- from
...
- exchange
...
- items
...
- at
...
- runtime
...
- and
...
- not
...
- buffer
...
- them
...
- somewhere.
...
- Easier
...
- to
...
- debug,
...
- VS2005
...
- debugger
...
- can
...
- be
...
- bound
...
- directly
...
- to
...
- properties
...
- Components
...
- may
...
- implement
...
- setters
...
- for
...
- input
...
- exchange
...
- items
...
- or
...
- only
...
- support
...
- getters
...
- Input
...
- exchange
...
- items
...
- may
...
- get
...
- values
...
- from
...
- connected
...
- output
...
- exchange
...
- items
...
- directly.
...
- User
...
- will
...
- not
...
- need
...
- time
...
- to
...
- get
...
- current
...
- value
...
- from
...
- exchange
...
- item
...
- (can
...
- be
...
- very
...
- useful
...
- for
...
- components
...
- not
...
- working
...
- with
...
- times)
...
For
...
those
...
components
...
which
...
need
...
to
...
work
...
with
...
time
...
the
...
following
...
solution
...
may
...
be
...
used:
Code Block |
---|
} interface ILinkableComponent { IList<IExchangeItem> InputItems { get; } IList<IExchangeItem> OutputItems { get; } void Update(); } interface ITimeRunnableComponent : ILinkableComponent { void Run(DateTime startTime, DateTime endTime); DateTime TimeHorizonStart { get; } // component will provide possible min start and max end times DateTime TimeHorizonEnd { get; } DateTime CurrentTime { get; } // will change after each run } class TimeRunnableComponentTests { void RunTimeRunnableComponent() { ITimeRunnableComponent c1 = ...; DateTime t0 = c1.TimeHorizonStart; TimeSpan duration = new TimeSpan(0, 0, 10); // hours, minutes, seconds DateTime t1 = t0.Add(duration); c1.Run(t0, t1); // check current component time DateTime currentComponentTime = c1.CurrentTime; Assert.AreEqual(t1, currentComponentTime); } void RunTimeRunnableComponentInGenericWay() { // StartTime, EndTime may be wrapped by input exchange items // which may be even linked to another component, e.g. controls in ComponentRunDialog. ILinkableComponent c1 = ...; // assume that 1st and 2nd output exchange items of component equal to time horizon start and end. DateTime t0 = (DateTime)c1.OutputItems[0].Value; TimeSpan duration = new TimeSpan(0, 0, 10); // hours, minutes, seconds DateTime t1 = t0.Add(duration); // assuming that 1st and 2nd input exchange items of component used as run star and run end times c1.InputItems[0].Value = t0; c1.InputItems[1].Value = t1; c1.Update(); // assume that 3rt output exchange item of component is "current time" Assert.AreEqual(c1.OutputItems[2].Name, "current time"); // check current component time DateTime currentComponentTime = (DateTime)c1.OutputItems[2].Value; Assert.AreEqual(t1, currentTime); } } {code} |
scrollbar |
---|