Show / Hide Table of Contents

Class StandaloneTransformation

Class that inherits from Transformation to describe, through delegate properties called by the base class' overridden methods, the actions to be executed on IEntity objects in order to mutate or modify its properties or behavior and find a solution to a puzzle. Its purpose is to provide a convenient way for describing a transformation without creating custom classes.

Inheritance
System.Object
Transformation
StandaloneTransformation
Implements
ITransformation
Inherited Members
Transformation.Title
Transformation.Run(EntityCollection, IEnvironment)
Namespace: TreeProblemFramework.Description.Transformations

Constructors

StandaloneTransformation(String)

Initializes a new instance of the Transformation class with the specified title.

Declaration
public StandaloneTransformation(string title)
Parameters
Type Name Description
System.String title

The transformation title.

Properties

EntityValidator

Gets or sets the delegate function that checks whether the actions defined for the current transformation are to be executed on the specified IEntity objects based on the specified IEnvironment object.

Declaration
public EntityValidator EntityValidator { get; set; }
Property Value
Type Description
EntityValidator

An instance of the EntityValidator delegate.

TransformationApplicator

Gets or sets the delegate function that executes the actions to modify the properties or behavior of the specified IEntity objects based on the specified IEnvironment object.

Declaration
public TransformationApplicator TransformationApplicator { get; set; }
Property Value
Type Description
TransformationApplicator

An instance of the TransformationApplicator delegate.

Methods

Apply(EntityCollection, IEnvironment)

Method that calls the delegate in TransformationApplicator with the provided arguments.

Declaration
protected override IEnumerable<IEnvironment> Apply(EntityCollection targetEntities, IEnvironment env)
Parameters
Type Name Description
EntityCollection targetEntities

The collection of IEntity objects to be passed to the delegate in TransformationApplicator.

IEnvironment env

The current IEnvironment to be passed to the delegate in TransformationApplicator.

Returns
Type Description
System.Collections.Generic.IEnumerable<IEnvironment>

The value returned by the delegate in TransformationApplicator.

Overrides
Transformation.Apply(EntityCollection, IEnvironment)
Exceptions
Type Condition
System.NotImplementedException

Thrown if TransformationApplicator is set to null.

Validate(EntityCollection, IEnvironment)

Method that calls the delegate in EntityValidator with the provided arguments.

Declaration
protected override bool Validate(EntityCollection targetEntities, IEnvironment env)
Parameters
Type Name Description
EntityCollection targetEntities

The collection of IEntity objects to be passed to the delegate in EntityValidator.

IEnvironment env

The current IEnvironment to be passed to the delegate in EntityValidator.

Returns
Type Description
System.Boolean

The value returned by the delegate in EntityValidator.

Overrides
Transformation.Validate(EntityCollection, IEnvironment)
Exceptions
Type Condition
System.NotImplementedException

Thrown if EntityValidator is set to null.

Implements

ITransformation
Back to top TreeProblemFramework from Ecuador.