Beispiel #1
0
        public static RecordField[] GetField
        (
            [NotNull] this IEnumerable <RecordField> fields,
            [NotNull] Func <RecordField, bool> fieldPredicate,
            [NotNull] Func <SubField, bool> subPredicate
        )
        {
            LocalList <RecordField> result = new LocalList <RecordField>();

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

            return(result.ToArray());
        }
Beispiel #2
0
        public static SubField[] GetSubField
        (
            [NotNull] this IEnumerable <RecordField> fields,
            [NotNull] string tag,
            char code
        )
        {
            LocalList <SubField> result = new LocalList <SubField>();

            foreach (RecordField field in fields)
            {
                if (!ReferenceEquals(field, null))
                {
                    if (field.Tag.SameString(tag))
                    {
                        foreach (SubField subField in field.SubFields)
                        {
                            if (subField.Code.SameChar(code))
                            {
                                result.Add(subField);
                            }
                        }
                    }
                }
            }

            return(result.ToArray());
        }
Beispiel #3
0
        public static RecordField[] GetField
        (
            [NotNull] this IEnumerable <RecordField> fields,
            char code,
            [NotNull] string value
        )
        {
            LocalList <RecordField> result = new LocalList <RecordField>();

            foreach (RecordField field in fields)
            {
                if (!ReferenceEquals(field, null))
                {
                    foreach (SubField subField in field.SubFields)
                    {
                        if (subField.Code.SameChar(code) &&
                            subField.Text.SameString(value))
                        {
                            result.Add(field);
                            break;
                        }
                    }
                }
            }

            return(result.ToArray());
        }
Beispiel #4
0
        public static RecordField[] GetFieldRegex
        (
            [NotNull] this IEnumerable <RecordField> fields,
            [NotNull] string[] tags,
            [NotNull] char[] codes,
            [NotNull] string textRegex
        )
        {
            LocalList <RecordField> result = new LocalList <RecordField>();

            foreach (RecordField field in fields)
            {
                if (!ReferenceEquals(field, null))
                {
                    if (field.Tag.OneOf(tags))
                    {
                        foreach (SubField subField in field.SubFields)
                        {
                            if (subField.Code.OneOf(codes) &&
                                !string.IsNullOrEmpty(subField.Text))
                            {
                                if (Regex.IsMatch(subField.Text, textRegex))
                                {
                                    result.Add(field);
                                    break;
                                }
                            }
                        }
                    }
                }
            }

            return(result.ToArray());
        }
Beispiel #5
0
        public static SubField[] GetSubField
        (
            [NotNull] this IEnumerable <RecordField> fields,
            [NotNull] string[] tags,
            [NotNull] char[] codes
        )
        {
            LocalList <SubField> result = new LocalList <SubField>();

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

            return(result.ToArray());
        }
Beispiel #6
0
        public static RecordField[] GetField
        (
            [NotNull] this IEnumerable <RecordField> fields,
            [NotNull] char[] codes,
            params string[] values
        )
        {
            LocalList <RecordField> result = new LocalList <RecordField>();

            foreach (RecordField field in fields)
            {
                if (!ReferenceEquals(field, null))
                {
                    foreach (SubField subField in field.SubFields)
                    {
                        if (subField.Code.OneOf(codes) &&
                            subField.Text.OneOf(values))
                        {
                            result.Add(field);
                            break;
                        }
                    }
                }
            }

            return(result.ToArray());
        }
Beispiel #7
0
        public static SubField[] GetSubFieldRegex
        (
            [NotNull] this IEnumerable <SubField> subFields,
            [NotNull] char[] codes,
            [NotNull] string textRegex
        )
        {
            LocalList <SubField> result = new LocalList <SubField>();

            foreach (SubField subField in subFields)
            {
                if (!ReferenceEquals(subField, null))
                {
                    if (subField.Code.OneOf(codes) &&
                        !string.IsNullOrEmpty(subField.Text))
                    {
                        if (Regex.IsMatch(subField.Text, textRegex))
                        {
                            result.Add(subField);
                        }
                    }
                }
            }
            return(result.ToArray());
        }
Beispiel #8
0
        public static RecordField[] GetField
        (
            [NotNull] this RecordFieldCollection fields,
            [NotNull] string tag
        )
        {
            LocalList <RecordField> result = new LocalList <RecordField>();
            int count = fields.Count;

            for (int i = 0; i < count; i++)
            {
                if (fields[i].Tag.SameString(tag))
                {
                    result.Add(fields[i]);
                }
            }

            return(result.ToArray());
        }
Beispiel #9
0
        public static SubField[] GetSubField
        (
            [NotNull] this SubFieldCollection subFields,
            params char[] codes
        )
        {
            int count = subFields.Count;
            LocalList <SubField> result = new LocalList <SubField>();

            for (int i = 0; i < count; i++)
            {
                if (subFields[i].Code.OneOf(codes))
                {
                    result.Add(subFields[i]);
                }
            }

            return(result.ToArray());
        }
Beispiel #10
0
        public static string[] GetFieldText
        (
            [NotNull] this RecordFieldCollection fields
        )
        {
            int count = fields.Count;
            LocalList <string> result = new LocalList <string>();

            for (int i = 0; i < count; i++)
            {
                string text = fields[i].Text;
                if (!string.IsNullOrEmpty(text))
                {
                    result.Add(text);
                }
            }

            return(result.ToArray());
        }
Beispiel #11
0
        public static RecordField[] GetField
        (
            [NotNull] this RecordFieldCollection fields,
            params string[] tags
        )
        {
            int count = fields.Count;
            LocalList <RecordField> result = new LocalList <RecordField>();

            for (int i = 0; i < count; i++)
            {
                if (fields[i].Tag.OneOf(tags))
                {
                    result.Add(fields[i]);
                }
            }

            return(result.ToArray());
        }
Beispiel #12
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());
        }
Beispiel #13
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());
        }
Beispiel #14
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());
        }
Beispiel #15
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());
        }
Beispiel #16
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());
        }
Beispiel #17
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());
        }