Beispiel #1
0
        /// <summary> Returns the segment specified in the given segment_path_spec. </summary>
        public virtual Segment getSegment(System.String segSpec)
        {
            Segment seg = null;

            if (segSpec.Substring(0, (1) - (0)).Equals("/"))
            {
                Finder.reset();
            }

            SupportClass.Tokenizer tok    = new SupportClass.Tokenizer(segSpec, "/", false);
            NuGenSegmentFinder     finder = Finder;

            while (tok.HasMoreTokens())
            {
                System.String        pathSpec = tok.NextToken();
                NuGenTerser.PathSpec ps       = parsePathSpec(pathSpec);
                if (tok.HasMoreTokens())
                {
                    ps.isGroup = true;
                }
                else
                {
                    ps.isGroup = false;
                }

                if (ps.isGroup)
                {
                    Group g = null;
                    if (ps.find)
                    {
                        g = finder.findGroup(ps.pattern, ps.rep);
                    }
                    else
                    {
                        g = finder.getGroup(ps.pattern, ps.rep);
                    }
                    finder = new NuGenSegmentFinder(g);
                }
                else
                {
                    if (ps.find)
                    {
                        seg = finder.findSegment(ps.pattern, ps.rep);
                    }
                    else
                    {
                        seg = finder.getSegment(ps.pattern, ps.rep);
                    }
                }
            }

            return(seg);
        }
Beispiel #2
0
 /// <summary>Creates a new instance of Terser </summary>
 public NuGenTerser(Message message)
 {
     finder = new NuGenSegmentFinder(message);
 }