Exemplo n.º 1
0
 public GenSegBody(GenContainerFragmentBase parentSegment, GenContainerFragmentBase parentContainer)
 {
     _fragment          = new List <GenFragment>();
     _secondaryFragment = new List <GenFragment>();
     ParentSegment      = parentSegment;
     ParentContainer    = parentContainer;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Parameters for creating a GenFragment
 /// </summary>
 /// <param name="genDataDef">The definition of the data being generated.</param>
 /// <param name="parentContainer">The container fragment conataining this fragment.</param>
 /// <param name="isPrimary">Is this fragmnent in the primary body?</param>
 public GenFragmentParams(GenDataDef genDataDef, GenContainerFragmentBase parentContainer, bool isPrimary = true)
 {
     Contract.Requires(parentContainer != null && parentContainer != null);
     GenDataDef      = genDataDef;
     ParentContainer = parentContainer;
     Container       = ParentContainer == null ? null : (ContainerFragment)ParentContainer.Fragment;
     IsPrimary       = isPrimary;
 }
Exemplo n.º 3
0
        public GenLookupParams(GenDataDef genDataDef, GenContainerFragmentBase parentContainer, string condition, bool isPrimary = true)
            : base(genDataDef, parentContainer, FragmentType.Lookup, isPrimary: isPrimary)
        {
            var sa = condition.Split('=');

            Var1 = GenDataDef.GetId(sa[0]);
            Var2 = GenDataDef.GetId(sa[1]);
        }
Exemplo n.º 4
0
 /// <summary>
 ///     Create a new <see cref="GenFragment" /> object.
 /// </summary>
 /// <param name="genFragmentParams">Data need to create the fragment object</param>
 protected GenFragment(GenFragmentParams genFragmentParams)
 {
     GenDataDef      = genFragmentParams.GenDataDef;
     ParentContainer = genFragmentParams.ParentContainer;
     FragmentType    = genFragmentParams.FragmentType;
     Fragment        = genFragmentParams.Fragment;
     Contract.Assert(Fragment != null, "The fragment was not set up");
 }
Exemplo n.º 5
0
 public GenConditionParams(GenDataDef genDataDef, GenContainerFragmentBase parentContainer, ConditionParameters conditionParameters, bool isPrimary = true)
     : base(genDataDef, parentContainer, FragmentType.Condition, isPrimary: isPrimary)
 {
     Var1          = conditionParameters.Var1;
     Var2          = conditionParameters.Var2;
     GenComparison = conditionParameters.GenComparison;
     UseLit        = conditionParameters.UseLit;
     Lit           = conditionParameters.Lit;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Parameters for creating a GenFragment
 /// </summary>
 /// <param name="genDataDef">The definition of the data being generated.</param>
 /// <param name="parentContainer">The container fragment conataining this fragment.</param>
 /// <param name="fragmentType">The type of fragment.</param>
 /// <param name="isPrimary">Is this fragmnent in the primary body?</param>
 public GenFragmentParams(GenDataDef genDataDef, GenContainerFragmentBase parentContainer, FragmentType fragmentType, bool isPrimary = true)
 {
     Contract.Requires(parentContainer != null);
     Contract.Ensures(fragmentType == FragmentType.Profile || Fragment != null);
     GenDataDef      = genDataDef;
     ParentContainer = parentContainer;
     Container       = ParentContainer == null ? null : (ContainerFragment)ParentContainer.Fragment;
     IsPrimary       = isPrimary;
     SetFragmentType(fragmentType);
 }
Exemplo n.º 7
0
 public GenFunctionParams(GenDataDef genDataDef, GenContainerFragmentBase parentContainer, string functionName, bool isPrimary = true) : base(genDataDef, parentContainer, isPrimary: isPrimary)
 {
     FunctionName = functionName;
 }
Exemplo n.º 8
0
 /// <summary>
 ///     Parameters for creating a GenFragment
 /// </summary>
 /// <param name="genDataDef">The definition of the data being generated.</param>
 /// <param name="parentContainer">The container fragment conataining this fragment.</param>
 /// <param name="text">The text to be generated.</param>
 /// <param name="isPrimary">The fragment is part of the primary part of the body.</param>
 public GenTextFragmentParams(GenDataDef genDataDef, GenContainerFragmentBase parentContainer, string text, bool isPrimary = true)
     : base(genDataDef, parentContainer, FragmentType.Text, isPrimary: isPrimary)
 {
     ((Text)Fragment).TextValue = text;
 }
Exemplo n.º 9
0
 public GenPlaceholderFragmentParams(GenDataDef genDataDef, GenContainerFragmentBase parentContainer, GenDataId id, bool isPrimary = true)
     : base(genDataDef, parentContainer, FragmentType.Placeholder, isPrimary: isPrimary)
 {
     Id = id;
 }
        public override GenSegment ParseSegmentHeading(GenDataDef genDataDef, string segmentClass, GenContainerFragmentBase parentContainer, bool isPrimary)
        {
            var s           = segmentClass.Substring(segmentClass.Length - 1);
            var c           = segmentClass;
            var cardinality = GenCardinality.All;

            for (var i = 0; i < ActiveProfileFragmentSyntaxDictionary.GenCardinalityText.Length; i++)
            {
                var x = ActiveProfileFragmentSyntaxDictionary.GenCardinalityText[i];
                if (s == x)
                {
                    cardinality = (GenCardinality)i;
                    c           = segmentClass.Substring(0, segmentClass.Length - 1);
                    break;
                }
            }
            return(new GenSegment(new GenSegmentParams(genDataDef, parentContainer, c, cardinality, isPrimary: isPrimary)));
        }
Exemplo n.º 11
0
 /// <summary>
 ///     Parses the segment class text and returns an empty segment profile fragment
 /// </summary>
 /// <param name="genDataDef">The generator data definition.</param>
 /// <param name="segmentClass">The segment class text to be parsed.</param>
 /// <param name="parentContainer"></param>
 /// <param name="isPrimary"></param>
 /// <returns></returns>
 public abstract GenSegment ParseSegmentHeading(GenDataDef genDataDef, string segmentClass, GenContainerFragmentBase parentContainer, bool isPrimary);
Exemplo n.º 12
0
 public GenSegmentParams(GenDataDef genDataDef, GenContainerFragmentBase parentContainer, string className, GenCardinality cardinality, bool isPrimary = true)
     : base(genDataDef, parentContainer, isPrimary: isPrimary)
 {
     _className   = className;
     _cardinality = cardinality;
 }