Transform

A Transform is a mechanism for changing a source name into a new, modified name. Transforming names is useful for adding some determinism in name generation or for creating iterations on an established name. Transform can have an optional condition that must be fulfilled for a transformation to occur.

Implements: IPotentialAction, Archigen.IWeighted, INameTransformer, IRandomizable

Constructors

Constructor
Description

Transform()

Instantiates a new Transform. By default, a Transform has no optional condition and a weight of 1.

Methods

Method
Returns
Description

AddStep(TransformStep step)

Adds a new step to this transform.

Apply(Name name)

Applies this Transform on the specified Name and returns a new Name as a result. The transform may result in no changes if a condition was added and is not met, or if the ** property is between 0 and 1 exclusive (less than 100%). This method leaves the source Name unchanged.

Modify(Name name)

System.Void

Applies this Transform on the specified Name in a destructive manner. For a non-destructive alternative, use Syllabore.Transform.Apply instead. The transform may result in no changes if a condition was added and is not met, or if the ** property is between 0 and 1 exclusive (less than 100%).

Properties

Property
Type
Description

Chance

System.Double

The probability this Transform will attempt to change a name when Syllabore.Transform.Apply is called. The value must be a double between 0 and 1 inclusive. Note that each TransformStep in this Transform can also have its own chance value.

ConditionalIndex

System.Nullable <System.Int32>

The index of the syllable that the condition operates on. A negative index can be provided to traverse right-to-left from the end of the name instead.

ConditionalRegex

System.String

A regular expression that must be satisfied for the transform to be applied.

Random

System.Random

Used to simulate randomness.

Steps

System.Collections.Generic.List <TransformStep>

The TransformStep that this transform will execute.

Weight

System.Int32

A positive integer that influences the probability of this transform being used over others. Given two transforms X and Y with a weight of 3 and 1 respectively, transform X will be applied 75% of the time. All transforms default to a weight of 1.

Last updated