Example #1
0
        public static SubField[] GetSubField
        (
            this RecordField field,
            char code
        )
        {
            SubFieldCollection subFields = field.SubFields;
            int             count        = subFields.Length;
            List <SubField> result       = null;

            for (int i = 0; i < count; i++)
            {
                if (Utility.SameChar(subFields[i].Code, code))
                {
                    if (ReferenceEquals(result, null))
                    {
                        result = new List <SubField>();
                    }
                    result.Add(subFields[i]);
                }
            }

            return(ReferenceEquals(result, null)
                ? EmptySubFieldArray
                : result.ToArray());
        }
Example #2
0
        public static SubField[] GetSubField
        (
            this SubFieldCollection subFields,
            params char[] codes
        )
        {
            int             count  = subFields.Length;
            List <SubField> result = null;

            for (int i = 0; i < count; i++)
            {
                if (Utility.OneOf(subFields[i].Code, codes))
                {
                    if (ReferenceEquals(result, null))
                    {
                        result = new List <SubField>();
                    }
                    result.Add(subFields[i]);
                }
            }

            return(ReferenceEquals(result, null)
                ? EmptySubFieldArray
                : result.ToArray());
        }
Example #3
0
        public static SubField[] GetSubField
        (
            this SubFieldCollection subFields,
            Action <SubField> action
        )
        {
            int count = subFields.Length;

            SubField[] result = new SubField[count];
            for (int i = 0; i < count; i++)
            {
                SubField item = subFields[i];
                result[i] = item;
                action(item);
            }

            return(result);
        }
Example #4
0
        public static bool HaveSubField
        (
            this RecordField field,
            params char[] codes
        )
        {
            SubFieldCollection subFields = field.SubFields;
            int count = subFields.Length;

            for (int i = 0; i < count; i++)
            {
                if (Utility.OneOf(subFields[i].Code, codes))
                {
                    return(true);
                }
            }

            return(false);
        }
Example #5
0
        // ==========================================================

        public static bool HaveSubField
        (
            this RecordField field,
            char code
        )
        {
            SubFieldCollection subFields = field.SubFields;
            int count = subFields.Length;

            for (int i = 0; i < count; i++)
            {
                if (Utility.SameChar(subFields[i].Code, code))
                {
                    return(true);
                }
            }

            return(false);
        }
Example #6
0
        public static SubField GetSubField
        (
            this RecordField field,
            char code,
            int occurrence
        )
        {
            SubFieldCollection subFields = field.SubFields;
            int count = subFields.Length;

            for (int i = 0; i < count; i++)
            {
                if (Utility.SameChar(subFields[i].Code, code))
                {
                    if (occurrence == 0)
                    {
                        return(subFields[i]);
                    }
                    occurrence--;
                }
            }

            return(null);
        }
Example #7
0
 public RecordField(int tag)
 {
     Tag        = tag;
     _subFields = new SubFieldCollection();
 }
Example #8
0
 public RecordField(string tag)
 {
     Tag        = int.Parse(tag);
     _subFields = new SubFieldCollection();
 }