public Name expand(String expandStr)
        {
            Name result = new Name();

            NdnRegexBackrefManager backrefManager = ((isSecondaryUsed_) ? secondaryBackrefManager_
                                        : primaryBackrefManager_);

            int backrefNo = backrefManager.size();

            String expand;

            if (!expandStr.equals(""))
            {
                expand = expandStr;
            }
            else
            {
                expand = expand_;
            }

            int[] offset = new int[] { 0 };
            while (offset[0] < expand.Length)
            {
                String item = getItemFromExpand(expand, offset);
                if (item[0] == '<')
                {
                    result.append(item.Substring(1, (item.Length - 1) - (1)));
                }

                if (item[0] == '\\')
                {
                    int index = Int32.Parse(item.Substring(1, (item.Length) - (1)));

                    if (0 == index)
                    {
                        /* foreach */
                        foreach (Name.Component component  in  matchResult_)
                        {
                            result.append(component);
                        }
                    }
                    else if (index <= backrefNo)
                    {
                        /* foreach */
                        foreach (Name.Component component_0  in  backrefManager.getBackref(
                                     index - 1).getMatchResult())
                        {
                            result.append(component_0);
                        }
                    }
                    else
                    {
                        throw new NdnRegexMatcherBase.Error(
                                  "Exceed the range of back reference");
                    }
                }
            }

            return(result);
        }
Exemple #2
0
        /// <summary>
        /// Create an NdnRegexComponentSetMatcher matcher from expr.
        /// </summary>
        ///
        /// <param name="expr">The standard regular expression to match a component.</param>
        /// <param name="backrefManager">A back-reference manager.</param>
        public NdnRegexComponentSetMatcher(String expr,
                                           NdnRegexBackrefManager backrefManager) : base(expr, net.named_data.jndn.util.regex.NdnRegexMatcherBase.NdnRegexExprType.COMPONENT_SET, backrefManager)
        {
            this.components_  = new ArrayList <NdnRegexComponentMatcher>();
            this.isInclusion_ = true;

            compile();
        }
Exemple #3
0
        public NdnRegexComponentMatcher(String expr,
                                        NdnRegexBackrefManager backrefManager) : base(expr, net.named_data.jndn.util.regex.NdnRegexMatcherBase.NdnRegexExprType.COMPONENT, backrefManager)
        {
            this.pseudoMatchers_ = new ArrayList <NdnRegexPseudoMatcher>();
            isExactMatch_        = true;

            compile();
        }
Exemple #4
0
 public NdnRegexMatcherBase(String expr, NdnRegexMatcherBase.NdnRegexExprType type)
 {
     this.matchers_    = new ArrayList <NdnRegexMatcherBase>();
     this.matchResult_ = new ArrayList <Name.Component>();
     expr_             = expr;
     type_             = type;
     backrefManager_   = new NdnRegexBackrefManager();
 }
Exemple #5
0
        public NdnRegexRepeatMatcher(String expr,
                                     NdnRegexBackrefManager backrefManager, int indicator) : base(expr, net.named_data.jndn.util.regex.NdnRegexMatcherBase.NdnRegexExprType.REPEAT_PATTERN, backrefManager)
        {
            this.repeatMin_ = 0;
            this.repeatMax_ = 0;
            indicator_      = indicator;

            compile();
        }
 public NdnRegexPatternListMatcher(String expr,
                                   NdnRegexBackrefManager backrefManager) : base(expr, net.named_data.jndn.util.regex.NdnRegexMatcherBase.NdnRegexExprType.PATTERN_LIST, backrefManager)
 {
     compile();
 }
Exemple #7
0
 public NdnRegexBackrefMatcher(String expr,
                               NdnRegexBackrefManager backrefManager) : base(expr, net.named_data.jndn.util.regex.NdnRegexMatcherBase.NdnRegexExprType.BACKREF, backrefManager)
 {
 }