/// <summary>
        /// Extracts a type from another type and returns the result of the operation.
        /// </summary>
        /// <param name="parameters">Parameters to the operation.</param>
        /// <returns>Result of the operation.</returns>
        public ExtractTypeResult ExtractType(ExtractTypeParameters parameters)
        {
            parameters.Validate();
              var sourceType = parameters.SourceType;

              var result = new ExtractTypeResult();
              sourceType.Accept(CreateVisitor(parameters, result));

              if (result.Success) {
            if (parameters.AddTypeStrategy == AddTypeStrategy.AddAsNested) {
              sourceType.NestedTypes.Add(result.TargetType);
            }
              }

              return result;
        }
 /// <summary>
 /// Creates a new instance of this class.
 /// </summary>
 /// <param name="parameters">Parameters to the extraction.</param>
 /// <param name="result">Result of the extraction.</param>
 public ExtractStateClassVisitor(ExtractTypeParameters parameters, ExtractTypeResult result)
     : base(parameters, result)
 {
 }
 /// <summary>
 /// Creates the visitor necessary to extract the state class from a role class.
 /// </summary>
 /// <param name="parameters">Parameters for the extraction.</param>
 /// <param name="result">Result of the extraction.</param>
 /// <returns>The visitor for the extraction.</returns>
 protected override ITypeVisitor CreateVisitor(ExtractTypeParameters parameters, ExtractTypeResult result)
 {
     return new ExtractStateClassVisitor(parameters, result);
 }
 /// <summary>
 /// Creates a new instance of this class.
 /// </summary>
 /// <param name="parameters">Parameters to the type extraction.</param>
 /// <param name="result">Result of the type extraction.</param>
 /// <remarks>
 /// This class will visit the source type in the <paramref name="parameters"/>,
 /// and extract a target type that will be stored in the <paramref name="result"/>.
 /// </remarks>
 protected ExtractTypeMutatorVisitor(ExtractTypeParameters parameters, ExtractTypeResult result)
 {
     Parameters = parameters;
     Result = result;
 }
 /// <summary>
 /// Creates a <see cref="ITypeVisitor"/> that will visit the source type given in the 
 /// <paramref name="parameters"/> and extract the target type, which will be set in the
 /// <paramref name="result"/>
 /// </summary>
 /// <param name="parameters">Parameters to the type extraction.</param>
 /// <param name="result">Result of the type extraction.</param>
 /// <returns>Visitor that performs the type extraction.</returns>
 /// <remarks>
 /// Use the class <see cref="ExtractTypeMutatorVisitor"/> as a base to easily create a 
 /// visitor.
 /// </remarks>
 protected abstract ITypeVisitor CreateVisitor(ExtractTypeParameters parameters, ExtractTypeResult result);