Ejemplo n.º 1
0
        public static string[] GetFieldText
        (
            [NotNull] this IEnumerable <RecordField> fields
        )
        {
            LocalList <string> result = new LocalList <string>();

            foreach (RecordField field in fields)
            {
                if (!ReferenceEquals(field, null))
                {
                    string text = field.Text;
                    if (!string.IsNullOrEmpty(text))
                    {
                        result.Add(text);
                    }
                }
            }

            return(result.ToArray());
        }
Ejemplo n.º 2
0
        public static SubField[] GetSubField
        (
            [NotNull] this IEnumerable <SubField> subFields,
            params char[] codes
        )
        {
            LocalList <SubField> result = new LocalList <SubField>();

            foreach (SubField subField in subFields)
            {
                if (!ReferenceEquals(subField, null))
                {
                    if (subField.Code.OneOf(codes))
                    {
                        result.Add(subField);
                    }
                }
            }

            return(result.ToArray());
        }
Ejemplo n.º 3
0
        public static RecordField[] GetField
        (
            [NotNull] this IEnumerable <RecordField> fields,
            [NotNull] string tag
        )
        {
            LocalList <RecordField> result = new LocalList <RecordField>();

            foreach (RecordField field in fields)
            {
                if (!ReferenceEquals(field, null))
                {
                    if (field.Tag.SameString(tag))
                    {
                        result.Add(field);
                    }
                }
            }

            return(result.ToArray());
        }
Ejemplo n.º 4
0
        public static RecordField[] GetField
        (
            [NotNull] this IEnumerable <RecordField> fields,
            [NotNull] Func <RecordField, bool> predicate
        )
        {
            LocalList <RecordField> result = new LocalList <RecordField>();

            foreach (RecordField field in fields)
            {
                if (!ReferenceEquals(field, null))
                {
                    if (predicate(field))
                    {
                        result.Add(field);
                    }
                }
            }

            return(result.ToArray());
        }
Ejemplo n.º 5
0
        public static SubField[] GetSubFieldRegex
        (
            [NotNull] this IEnumerable <SubField> subFields,
            [NotNull] string codeRegex
        )
        {
            LocalList <SubField> result = new LocalList <SubField>();

            foreach (SubField subField in subFields)
            {
                if (!ReferenceEquals(subField, null))
                {
                    if (Regex.IsMatch(codeRegex, subField.CodeString))
                    {
                        result.Add(subField);
                    }
                }
            }

            return(result.ToArray());
        }
Ejemplo n.º 6
0
        public static RecordField[] GetFieldRegex
        (
            [NotNull] this IEnumerable <RecordField> fields,
            [NotNull] string tagRegex
        )
        {
            LocalList <RecordField> result = new LocalList <RecordField>();

            foreach (RecordField field in fields)
            {
                if (!ReferenceEquals(field, null) &&
                    !string.IsNullOrEmpty(field.Tag))
                {
                    if (Regex.IsMatch(field.Tag, tagRegex))
                    {
                        result.Add(field);
                    }
                }
            }

            return(result.ToArray());
        }
Ejemplo n.º 7
0
        public static SubField[] AllSubFields
        (
            [NotNull] this IEnumerable <RecordField> fields
        )
        {
            LocalList <SubField> result = new LocalList <SubField>();

            foreach (RecordField field in fields)
            {
                if (!ReferenceEquals(field, null))
                {
                    foreach (SubField subField in field.SubFields)
                    {
                        if (!ReferenceEquals(subField, null))
                        {
                            result.Add(subField);
                        }
                    }
                }
            }

            return(result.ToArray());
        }