Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Issue

  • Remove problem of how DataOperations are defined in standard by showing how a simple change to the interface can let people do whatever they want!

Proposal

  • For Transform you could read DataOperation!
Code Block
titleProposed addition to Standard
borderStylesolid
    public interface IExchangeTransform
    {
        IExchangeItem ExchangeItemOriginal { set; get; }
        IExchangeItem ExchangeItemAlternative { get; }
        IValueSet Transform(IValueSet value);
    }

    // Optional Extension for ILinkableComponent

    interface IExchangeTransformable
    {
        int SuggestedTransformsCount { get; }
        IExchangeTransform TransformSugestion(int index);
    }

Example

Code Block
titleExample of use
borderStylesolid
        static void Transforms()
        {
            ITime time = new TimeStamp(10.0);
            string linkid = "wibble";

            // has an output exchange item which returns Reed Growth as a height (IScalar/double)
            ILinkableComponent iLC = new LinkableComponentReedGrowth();

            IValueSet vs = iLC.GetValues(time, linkid);

            double d = ((IScalarSet)vs).GetScalar(0);

            string id = iLC.GetOutputExchangeItem(0).Quantity.ID;
            string idd = iLC.GetOutputExchangeItem(0).Quantity.Description;

            // make 3rd party Linkable component transformable
            LinkableComponentTransformable iLCA = new LinkableComponentTransformable(iLC);

            // change Reed Growth by linear transform y = 10x + 5
            int index = iLCA.AddTransformOutput("ReedGrowthHeight", new LinearTransform(10, 5));

            IValueSet vs2 = iLCA.GetValues(time, linkid);

            double d2 = ((IScalarSet)vs2).GetScalar(0);

            string ida = iLCA.GetOutputExchangeItem(index).Quantity.ID;
            string idda = iLCA.GetOutputExchangeItem(index).Quantity.Description;
        }

...