Show / Hide Table of Contents

Class Computation

This class represents a single computation within the transformation engine of NMF.Transformations

Inheritance
object
Computation
SynchronizationComputation<TIn, TOut>
ComputationBase
ComputationBase<TIn>
ComputationBase<TIn1, TIn2>
MockComputation
Implements
IPersistor
ITraceEntry
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: NMF.Transformations.Core
Assembly: NMF.Transformations.Core.dll
Syntax
public abstract class Computation : IPersistor, ITraceEntry
Remarks

This class is visible to public as it provides reaction to delayness

Constructors

| Edit this page View Source

Computation(GeneralTransformationRule, IComputationContext)

Creates a new computation for the given transformation rule with the given input arguments

Declaration
protected Computation(GeneralTransformationRule transformationRule, IComputationContext context)
Parameters
Type Name Description
GeneralTransformationRule transformationRule

The transformation rule responsible for the transformation of the input data

IComputationContext context

The transformation context, in which the computation is done

Properties

| Edit this page View Source

Context

Gets the computation context for this computation

Declaration
public IComputationContext Context { get; }
Property Value
Type Description
IComputationContext
| Edit this page View Source

InputArguments

Gets the number of input arguments

Declaration
public int InputArguments { get; }
Property Value
Type Description
int
| Edit this page View Source

IsDelayed

Gets a value indicating whether the output creation for this computation is delayed

Declaration
public bool IsDelayed { get; }
Property Value
Type Description
bool
| Edit this page View Source

Output

Gets the output of this computation

Declaration
public object Output { get; }
Property Value
Type Description
object
Exceptions
Type Condition
InvalidOperationException

This property may throw a DelayedOutputCreationException in case that the output has been tried to access, although the output creation was delayed

| Edit this page View Source

OutputCore

Gets or sets the output in a derived class

Declaration
protected abstract object OutputCore { get; set; }
Property Value
Type Description
object
| Edit this page View Source

TransformationContext

Gets the context, in which the computation has been made

Declaration
public ITransformationContext TransformationContext { get; }
Property Value
Type Description
ITransformationContext
| Edit this page View Source

TransformationRule

Gets the transformation rule, which has been used to compute this computation

Declaration
public GeneralTransformationRule TransformationRule { get; }
Property Value
Type Description
GeneralTransformationRule

Methods

| Edit this page View Source

CreateInputArray()

Copies the input of this computation into an array

Declaration
public object[] CreateInputArray()
Returns
Type Description
object[]

An array with the inputs

| Edit this page View Source

CreateOutput(IEnumerable)

Creates the output of this transformation rule

Declaration
public abstract object CreateOutput(IEnumerable context)
Parameters
Type Name Description
IEnumerable context
Returns
Type Description
object

The output for this transformation under this input

Remarks

At this point, not all of the computations have created their output and thus, the trace is not complete. Use the OutputDelayLevel-feature to have the trace contain all elements created in earlier levels

| Edit this page View Source

DelayOutputAtLeast(byte)

Configures the computation to create its output at minimum with the given delay level

Declaration
public void DelayOutputAtLeast(byte delayLevel)
Parameters
Type Name Description
byte delayLevel

The minimum delay level for this computation

| Edit this page View Source

DelayTransformationAtLeast(byte)

Configures the computation to be transformed at least with the given delay level

Declaration
public void DelayTransformationAtLeast(byte delayLevel)
Parameters
Type Name Description
byte delayLevel
| Edit this page View Source

GetInput(int)

Gets the input argument for this computation with the given index

Declaration
public abstract object GetInput(int index)
Parameters
Type Name Description
int index

The index of the input parameter

Returns
Type Description
object

The input parameter at the ith position

| Edit this page View Source

InitializeOutput(object)

Initializes the output for the actual computation

Declaration
public void InitializeOutput(object output)
Parameters
Type Name Description
object output

The intended output

| Edit this page View Source

MarkRequire(Computation, bool, ITransformationRuleDependency)

Marks that this computations requires another to be transformed.

Declaration
public virtual void MarkRequire(Computation other, bool isRequired, ITransformationRuleDependency dependency)
Parameters
Type Name Description
Computation other

The other computation

bool isRequired

A value indicating whether the other computation must be execute before or after the current computation

ITransformationRuleDependency dependency

The dependency that required this

Remarks

The default implementation does nothing, so feel free to override. This method is intended to be called by NMF.Transformations, only.

| Edit this page View Source

OnComputed(EventArgs)

Fires the Computed-event

Declaration
protected virtual void OnComputed(EventArgs e)
Parameters
Type Name Description
EventArgs e

The event arguments

| Edit this page View Source

OnOutputInitialized(EventArgs)

Fires the OutputInitialized-event

Declaration
protected virtual void OnOutputInitialized(EventArgs e)
Parameters
Type Name Description
EventArgs e

The event arguments

| Edit this page View Source

SetBaseComputation(Computation)

Sets the provided computation as the base computation

Declaration
public virtual void SetBaseComputation(Computation baseComputation)
Parameters
Type Name Description
Computation baseComputation

The base computation

Remarks

By default, this method is blank.

| Edit this page View Source

ThrowDelayedException()

Throws an exception that the output has been accessed although the output of teh computation is delayed

Declaration
protected static void ThrowDelayedException()
| Edit this page View Source

Transform()

Initializes the transformation output

Declaration
public abstract void Transform()
Remarks

At this point, all the transformation outputs are created (also the delayed ones), thus, the trace is fully reliable

Events

| Edit this page View Source

Computed

This event is fired as soon as the computation has been computed, i.e., the computation has been processed in the computation list

Declaration
public event EventHandler Computed
Event Type
Type Description
EventHandler
| Edit this page View Source

OutputInitialized

This event is fired as soon as the output of this computation is initialized

Declaration
public event EventHandler OutputInitialized
Event Type
Type Description
EventHandler

Implements

IPersistor
ITraceEntry

Extension Methods

TraceEntryExtensions.CreateInputArray(ITraceEntry)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX