Examples of matches()


Examples of jmathexpr.arithmetic.op.Exponentiation.matches()

        if (x.matches(expr) && (degree == null || degree.isOne())) { // x
            return n.matches(Naturals.one());
        } else {
            Exponentiation xn = new Exponentiation(x, n);
           
            if (xn.matches(expr) && (degree == null || degree.equals(n.hit()))) { // x^n
                return true;
            }           
        }
       
        return false;

Examples of jmathexpr.arithmetic.op.Multiplication.matches()

        NavigableMap<NaturalNumber, Expression> coeffs = new TreeMap();
        TerminationPattern c = Numbers.constant("c");
        TerminationPattern n = Numbers.constant("n");
        ExpressionPattern cxn = new Multiplication(c, new Exponentiation(x, n));

        if (cxn.matches(term)) {
            coeffs.put((NaturalNumber) n.hit(), c.hit());
        } else {
            throw new IllegalArgumentException("Illegal polynomial term: " + term);
        }
       

Examples of jmathexpr.arithmetic.op.Negation.matches()

            }
        } else {
            FunctionPattern f = new FunctionPattern(x);
            Negation nf = new Negation(f);
           
            if (nf.matches(expr) && matchesPower(f.hit())) {
                return coeff.matches(Integers.getInstance().create(-1));
            }
           
            Multiplication ax = new Multiplication(coeff, f);
           

Examples of jmathexpr.arithmetic.pattern.FractionPattern.matches()

        List<Expression> evaluated = evaluate(terms);
        List<Expression> denominators = new ArrayList();
        FractionPattern p = new FractionPattern();
       
        for (Expression t : evaluated) {
            if (p.matches(t)) {
                denominators.add(p.denominator());
            }
        }
       
        if (!denominators.isEmpty()) { // summing fractions

Examples of jmathexpr.arithmetic.pattern.PolynomialTermPattern.matches()

    }
   
    public static boolean isLinear(Expression expr, Variable x) {
        ExpressionPattern pattern = new PolynomialTermPattern(x, 1);
       
        if (pattern.matches(expr)) {
            return true;
        } else if (expr instanceof Negation) {
            return isLinear(((Negation) expr).getChild(), x);
        } else if (expr instanceof Division) {
            Expression lhs = ((Division) expr).lhs();

Examples of jmathexpr.util.pattern.ExpressionPattern.matches()

    }
   
    public static boolean isLinear(Expression expr, Variable x) {
        ExpressionPattern pattern = new PolynomialTermPattern(x, 1);
       
        if (pattern.matches(expr)) {
            return true;
        } else if (expr instanceof Negation) {
            return isLinear(((Negation) expr).getChild(), x);
        } else if (expr instanceof Division) {
            Expression lhs = ((Division) expr).lhs();

Examples of joshua.util.Regex.matches()

    try { for (String line : grammarReader) {
      line = line.trim();
      if (blankLine.matches(line)) {
        continue;
      }
      if (ngramsLine.matches(line)) { // \1-grams:
        start = true;
        order = Integer.parseInt(line.substring(1, 2));
        if (order > ngramOrder) {
          break;
        }

Examples of jregex.Matcher.matches()

            p.put("db.destroyMethod", "close");
        }

        Matcher m = new jregex.Pattern("^mysql:(//)?(({user}[a-zA-Z0-9_]+)(:({pwd}[^@]+))?@)?(({host}[^/]+)/)?({name}[^\\s]+)$").matcher(p.getProperty("db", ""));
        if (m.matches()) {
            String user = m.group("user");
            String password = m.group("pwd");
            String name = m.group("name");
            String host = m.group("host");
            p.put("db.driver", "com.mysql.jdbc.Driver");

Examples of juzu.impl.router.Route.matches()

      bridge.getRequestContext().setStatus(404);
    } else {
      if (requestMatch == null) {
        Route requestRoute = getRoute(requestTarget.getHandle());
        if (requestRoute != null) {
          requestMatch = requestRoute.matches(Collections.<String, String>emptyMap());
          if (requestMatch != null) {
            StringBuilder sb = new StringBuilder();
            requestMatch.render(new UriBuilder(sb));
            if (!sb.toString().equals(requestPath)) {
              StringBuilder redirect = new StringBuilder();

Examples of mf.org.apache.xerces.impl.xpath.regex.RegularExpression.matches()

        }
        if ( (fFacetsDefined & FACET_PATTERN ) != 0 ) {
            RegularExpression regex;
            for (int idx = fPattern.size()-1; idx >= 0; idx--) {
                regex = (RegularExpression)fPattern.elementAt(idx);
                if (!regex.matches(nvalue)){
                    throw new InvalidDatatypeValueException("cvc-pattern-valid",
                            new Object[]{content,
                            fPatternStr.elementAt(idx),

                            fTypeName});
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.