/// <summary>
        /// Selektuje linije na optimizocan nacin - prvo mainCriteria, pa onda redom relCriteria dok prvi ne pukne
        /// </summary>
        /// <param name="selector"></param>
        /// <returns></returns>
        public List <ncLine> selectLinesBySelector(ncLineSelector selector)
        {
            List <ncLine> input    = selectLines(selector.mainCriteria);
            Boolean       selectOk = false;

            List <ncLine> output = new List <ncLine>();

            foreach (ncLine line in input)
            {
                selectOk = true;
                foreach (ncLineRelativeCriteria relCriteria in selector)
                {
                    selectOk = testLineRelativeCriteria(line, relCriteria);
                    if (selectOk == false)
                    {
                        break;
                    }
                }
                if (selectOk)
                {
                    output.Add(line);
                }
            }

            return(output);
        }
Esempio n. 2
0
        public static String writeLineCriteriaInline(this ncLineCriteria criteria)
        {
            String output = "";

            output = output.add("Criteria type[" + criteria.GetType().Name + "]");

            if (criteria.commandCriteria == ncLineCommandPredefined.custom)
            {
                output.add("cust.command[" + criteria.customCommand + "]");
            }
            else
            {
                output.add("command[" + criteria.commandCriteria.ToString() + "]");
            }

            if (criteria is ncLineRelativeCriteria)
            {
                ncLineRelativeCriteria rc = criteria as ncLineRelativeCriteria;

                output.addVal("relation type: ", rc.relativeType.ToString());

                output.addVal("relation offset: ", rc.relativePosition.ToString());
            }

            if (criteria is ncLineSelector)
            {
                ncLineSelector sc = criteria as ncLineSelector;

                output.addVal("included relative criterias: ", sc.Count().ToString());

                foreach (ncLineRelativeCriteria rc in sc)
                {
                    output.log(rc.writeLineCriteriaInline());
                }
            }
            return(output);
        }