Ejemplo n.º 1
0
        public override Verb CreateVerb(string[] tokens)
        {
            Color(position, tokens[1].Length, Whitespaces);
            Color(tokens[2].Length, Numbers);
            Color(tokens[3].Length, Operators);
            Color(tokens[4].Length, Operators);

            var count         = tokens[2].ToInt();
            var span          = "";
            var elementNotSet = true;
            var not           = tokens[3] == "!";

            switch (tokens[4])
            {
            case "+":
                span = STRING_SPACES;
                break;

            case "@":
                span = STRING_WORDS;
                break;

            case "#":
                span = STRING_DIGITS;
                break;

            case "&":
                span = STRING_PUNCT;
                break;

            case "$":
                span = STRING_LETTERS;
                break;

            case ".":
                if (count == 0)
                {
                    count = 1;
                }
                Element       = new LengthElement(count);
                Instruction   = new LengthInstruction(count);
                elementNotSet = false;
                break;

            default:
                return(null);
            }

            if (elementNotSet)
            {
                if (not)
                {
                    Element = count > 0 ? (Element) new AnyElement(span, count)
                    {
                        Not = true
                    }
                }
            }
Ejemplo n.º 2
0
        public override void UpdateBufferFromValue(byte[] buffer)
        {
            //write array items on buffer..
            base.UpdateBufferFromValue(buffer);

            //update length element..
            _lengthGenericSetter.Invoke(this, new object[] { LengthElement, this.Length });

            //write length on buffer..
            LengthElement.UpdateBufferFromValue(buffer);
        }
Ejemplo n.º 3
0
            public override IDeepCopyable CopyTo(IDeepCopyable other)
            {
                var dest = other as SubunitComponent;

                if (dest == null)
                {
                    throw new ArgumentException("Can only copy to an object of the same type", "other");
                }

                base.CopyTo(dest);
                if (SubunitElement != null)
                {
                    dest.SubunitElement = (Hl7.Fhir.Model.Integer)SubunitElement.DeepCopy();
                }
                if (SequenceElement != null)
                {
                    dest.SequenceElement = (Hl7.Fhir.Model.FhirString)SequenceElement.DeepCopy();
                }
                if (LengthElement != null)
                {
                    dest.LengthElement = (Hl7.Fhir.Model.Integer)LengthElement.DeepCopy();
                }
                if (SequenceAttachment != null)
                {
                    dest.SequenceAttachment = (Hl7.Fhir.Model.Attachment)SequenceAttachment.DeepCopy();
                }
                if (FivePrime != null)
                {
                    dest.FivePrime = (Hl7.Fhir.Model.CodeableConcept)FivePrime.DeepCopy();
                }
                if (ThreePrime != null)
                {
                    dest.ThreePrime = (Hl7.Fhir.Model.CodeableConcept)ThreePrime.DeepCopy();
                }
                if (Linkage != null)
                {
                    dest.Linkage = new List <Hl7.Fhir.Model.SubstanceNucleicAcid.LinkageComponent>(Linkage.DeepCopy());
                }
                if (Sugar != null)
                {
                    dest.Sugar = new List <Hl7.Fhir.Model.SubstanceNucleicAcid.SugarComponent>(Sugar.DeepCopy());
                }
                return(dest);
            }
            public override IDeepCopyable CopyTo(IDeepCopyable other)
            {
                var dest = other as SubunitComponent;

                if (dest == null)
                {
                    throw new ArgumentException("Can only copy to an object of the same type", "other");
                }

                base.CopyTo(dest);
                if (SubunitElement != null)
                {
                    dest.SubunitElement = (Hl7.Fhir.Model.Integer)SubunitElement.DeepCopy();
                }
                if (SequenceElement != null)
                {
                    dest.SequenceElement = (Hl7.Fhir.Model.FhirString)SequenceElement.DeepCopy();
                }
                if (LengthElement != null)
                {
                    dest.LengthElement = (Hl7.Fhir.Model.Integer)LengthElement.DeepCopy();
                }
                if (SequenceAttachment != null)
                {
                    dest.SequenceAttachment = (Hl7.Fhir.Model.Attachment)SequenceAttachment.DeepCopy();
                }
                if (NTerminalModificationId != null)
                {
                    dest.NTerminalModificationId = (Hl7.Fhir.Model.Identifier)NTerminalModificationId.DeepCopy();
                }
                if (NTerminalModificationElement != null)
                {
                    dest.NTerminalModificationElement = (Hl7.Fhir.Model.FhirString)NTerminalModificationElement.DeepCopy();
                }
                if (CTerminalModificationId != null)
                {
                    dest.CTerminalModificationId = (Hl7.Fhir.Model.Identifier)CTerminalModificationId.DeepCopy();
                }
                if (CTerminalModificationElement != null)
                {
                    dest.CTerminalModificationElement = (Hl7.Fhir.Model.FhirString)CTerminalModificationElement.DeepCopy();
                }
                return(dest);
            }
Ejemplo n.º 5
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Media;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (TypeElement != null)
                {
                    dest.TypeElement = (Code <Hl7.Fhir.Model.Media.MediaType>)TypeElement.DeepCopy();
                }
                if (Subtype != null)
                {
                    dest.Subtype = (Hl7.Fhir.Model.CodeableConcept)Subtype.DeepCopy();
                }
                if (Identifier != null)
                {
                    dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
                }
                if (DateTimeElement != null)
                {
                    dest.DateTimeElement = (Hl7.Fhir.Model.FhirDateTime)DateTimeElement.DeepCopy();
                }
                if (Subject != null)
                {
                    dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy();
                }
                if (Operator != null)
                {
                    dest.Operator = (Hl7.Fhir.Model.ResourceReference)Operator.DeepCopy();
                }
                if (View != null)
                {
                    dest.View = (Hl7.Fhir.Model.CodeableConcept)View.DeepCopy();
                }
                if (DeviceNameElement != null)
                {
                    dest.DeviceNameElement = (Hl7.Fhir.Model.FhirString)DeviceNameElement.DeepCopy();
                }
                if (HeightElement != null)
                {
                    dest.HeightElement = (Hl7.Fhir.Model.Integer)HeightElement.DeepCopy();
                }
                if (WidthElement != null)
                {
                    dest.WidthElement = (Hl7.Fhir.Model.Integer)WidthElement.DeepCopy();
                }
                if (FramesElement != null)
                {
                    dest.FramesElement = (Hl7.Fhir.Model.Integer)FramesElement.DeepCopy();
                }
                if (LengthElement != null)
                {
                    dest.LengthElement = (Hl7.Fhir.Model.Integer)LengthElement.DeepCopy();
                }
                if (Content != null)
                {
                    dest.Content = (Hl7.Fhir.Model.Attachment)Content.DeepCopy();
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
Ejemplo n.º 6
0
        public override ErrorList Validate()
        {
            var result = new ErrorList();

            result.AddRange(base.Validate());

            if (TypeElement != null)
            {
                result.AddRange(TypeElement.Validate());
            }
            if (Subtype != null)
            {
                result.AddRange(Subtype.Validate());
            }
            if (Identifier != null)
            {
                Identifier.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (DateTimeElement != null)
            {
                result.AddRange(DateTimeElement.Validate());
            }
            if (Subject != null)
            {
                result.AddRange(Subject.Validate());
            }
            if (Requester != null)
            {
                result.AddRange(Requester.Validate());
            }
            if (Operator != null)
            {
                result.AddRange(Operator.Validate());
            }
            if (View != null)
            {
                result.AddRange(View.Validate());
            }
            if (DeviceNameElement != null)
            {
                result.AddRange(DeviceNameElement.Validate());
            }
            if (HeightElement != null)
            {
                result.AddRange(HeightElement.Validate());
            }
            if (WidthElement != null)
            {
                result.AddRange(WidthElement.Validate());
            }
            if (FramesElement != null)
            {
                result.AddRange(FramesElement.Validate());
            }
            if (LengthElement != null)
            {
                result.AddRange(LengthElement.Validate());
            }
            if (Content != null)
            {
                result.AddRange(Content.Validate());
            }

            return(result);
        }