> For the complete documentation index, see [llms.txt](https://sacro.gitbook.io/syllabore/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sacro.gitbook.io/syllabore/class-docs/transform.md).

# Transform

A [Transform](/syllabore/class-docs/transform.md) 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](/syllabore/class-docs/transform.md) can have an optional condition that must be fulfilled for a transformation to occur.

*Implements:* [*IPotentialAction*](/syllabore/class-docs/ipotentialaction.md)*, Archigen.IWeighted,* [*INameTransformer*](/syllabore/class-docs/inametransformer.md)*,* [*IRandomizable*](/syllabore/class-docs/irandomizable.md)

## Constructors

| Constructor | Description                                                                                                                                                                    |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Transform() | Instantiates a new [Transform](/syllabore/class-docs/transform.md). By default, a [Transform](/syllabore/class-docs/transform.md) has no optional condition and a weight of 1. |

## Methods

| Method                                                                | Returns                                         | Description                                                                                                                                                                                                                                                                                                                                                                                                                    |
| --------------------------------------------------------------------- | ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| AddStep([TransformStep](/syllabore/class-docs/transformstep.md) step) | [Transform](/syllabore/class-docs/transform.md) | Adds a new step to this transform.                                                                                                                                                                                                                                                                                                                                                                                             |
| Apply([Name](/syllabore/class-docs/name.md) name)                     | [Name](/syllabore/class-docs/name.md)           | Applies this [Transform](/syllabore/class-docs/transform.md) on the specified [Name](/syllabore/class-docs/name.md) and returns a new [Name](/syllabore/class-docs/name.md) 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](/syllabore/class-docs/name.md) unchanged. |
| Modify([Name](/syllabore/class-docs/name.md) name)                    | System.Void                                     | Applies this [Transform](/syllabore/class-docs/transform.md) on the specified [Name](/syllabore/class-docs/name.md) 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](/syllabore/class-docs/transform.md) 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](/syllabore/class-docs/transformstep.md) in this [Transform](/syllabore/class-docs/transform.md) 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](/syllabore/class-docs/transformstep.md)> | The [TransformStep](/syllabore/class-docs/transformstep.md) 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.                                                                                                                  |
