예제 #1
0
        public void Parse(string component, int position)
        {
            try
            {
                this.value    = component;
                this.position = position;

                if (component.Contains(AMP))
                {
                    List <string> delimitedResult = component.Split(AMP).ToList();

                    // place a buffer in field 0
                    delimitedResult.Insert(ZERO_ELEMENT, "");

                    for (int subComponentIndex = 1; subComponentIndex < delimitedResult.Count; subComponentIndex++)
                    {
                        SubComponent sc = new SubComponent();
                        sc.Parse(delimitedResult[subComponentIndex], subComponentIndex);
                        this.subComponents.Add(sc);
                    }
                }
            }
            catch (Exception e)
            {
                ErrorLogger.LogError(e, "Component.Parse(string component, int position)",
                                     component + "|" + position.ToString());
            }
        }
예제 #2
0
        public static SubComponent getSubComponentByPos(Component singleComponent, int position)
        {
            SubComponent sc = new SubComponent();

            try
            {
                int subComponentIndex = singleComponent.subComponents.FindIndex(x => x.position == position);

                sc = singleComponent.subComponents[subComponentIndex];
            }
            catch (Exception e)
            {
                ErrorLogger.LogError(e, "getSubComponentByPos(Component singleComponent, int position)",
                                     singleComponent.subComponents.Count.ToString() + " " + position.ToString());
            }
            return(sc);
        }
예제 #3
0
        public static Repetition getRepetitionByPos(SubComponent singleSubComponent, int position)
        {
            Repetition r = new Repetition();

            try
            {
                int repetitionIndex = singleSubComponent.repetitions.FindIndex(x => x.position == position);

                r = singleSubComponent.repetitions[repetitionIndex];
            }
            catch (Exception e)
            {
                ErrorLogger.LogError(e, "Repetition.getRepetitionByPos(SubComponent singleSubComponent, int position)",
                                     singleSubComponent.repetitions.Count().ToString() + "|" + position.ToString());
            }
            return(r);
        }