Java Code Examples for com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodType#distanceTo()

The following examples show how to use com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodType#distanceTo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Expression.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Search for a primop in the symbol table that matches the method type
 * <code>ctype</code>. Two methods match if they have the same arity.
 * If a primop is overloaded then the "closest match" is returned. The
 * first entry in the vector of primops that has the right arity is
 * considered to be the default one.
 */
public MethodType lookupPrimop(SymbolTable stable, String op,
                               MethodType ctype) {
    MethodType result = null;
    final Vector primop = stable.lookupPrimop(op);
    if (primop != null) {
        final int n = primop.size();
        int minDistance = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            final MethodType ptype = (MethodType) primop.elementAt(i);
            // Skip if different arity
            if (ptype.argsCount() != ctype.argsCount()) {
                continue;
            }

            // The first method with the right arity is the default
            if (result == null) {
                result = ptype;             // default method
            }

            // Check if better than last one found
            final int distance = ctype.distanceTo(ptype);
            if (distance < minDistance) {
                minDistance = distance;
                result = ptype;
            }
        }
    }
    return result;
}
 
Example 2
Source File: Expression.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Search for a primop in the symbol table that matches the method type
 * <code>ctype</code>. Two methods match if they have the same arity.
 * If a primop is overloaded then the "closest match" is returned. The
 * first entry in the vector of primops that has the right arity is
 * considered to be the default one.
 */
public MethodType lookupPrimop(SymbolTable stable, String op,
                               MethodType ctype) {
    MethodType result = null;
    final Vector primop = stable.lookupPrimop(op);
    if (primop != null) {
        final int n = primop.size();
        int minDistance = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            final MethodType ptype = (MethodType) primop.elementAt(i);
            // Skip if different arity
            if (ptype.argsCount() != ctype.argsCount()) {
                continue;
            }

            // The first method with the right arity is the default
            if (result == null) {
                result = ptype;             // default method
            }

            // Check if better than last one found
            final int distance = ctype.distanceTo(ptype);
            if (distance < minDistance) {
                minDistance = distance;
                result = ptype;
            }
        }
    }
    return result;
}
 
Example 3
Source File: Expression.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Search for a primop in the symbol table that matches the method type
 * <code>ctype</code>. Two methods match if they have the same arity.
 * If a primop is overloaded then the "closest match" is returned. The
 * first entry in the vector of primops that has the right arity is
 * considered to be the default one.
 */
public MethodType lookupPrimop(SymbolTable stable, String op,
                               MethodType ctype) {
    MethodType result = null;
    final Vector primop = stable.lookupPrimop(op);
    if (primop != null) {
        final int n = primop.size();
        int minDistance = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            final MethodType ptype = (MethodType) primop.elementAt(i);
            // Skip if different arity
            if (ptype.argsCount() != ctype.argsCount()) {
                continue;
            }

            // The first method with the right arity is the default
            if (result == null) {
                result = ptype;             // default method
            }

            // Check if better than last one found
            final int distance = ctype.distanceTo(ptype);
            if (distance < minDistance) {
                minDistance = distance;
                result = ptype;
            }
        }
    }
    return result;
}
 
Example 4
Source File: Expression.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Search for a primop in the symbol table that matches the method type
 * <code>ctype</code>. Two methods match if they have the same arity.
 * If a primop is overloaded then the "closest match" is returned. The
 * first entry in the vector of primops that has the right arity is
 * considered to be the default one.
 */
public MethodType lookupPrimop(SymbolTable stable, String op,
                               MethodType ctype) {
    MethodType result = null;
    final Vector primop = stable.lookupPrimop(op);
    if (primop != null) {
        final int n = primop.size();
        int minDistance = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            final MethodType ptype = (MethodType) primop.elementAt(i);
            // Skip if different arity
            if (ptype.argsCount() != ctype.argsCount()) {
                continue;
            }

            // The first method with the right arity is the default
            if (result == null) {
                result = ptype;             // default method
            }

            // Check if better than last one found
            final int distance = ctype.distanceTo(ptype);
            if (distance < minDistance) {
                minDistance = distance;
                result = ptype;
            }
        }
    }
    return result;
}
 
Example 5
Source File: Expression.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Search for a primop in the symbol table that matches the method type
 * <code>ctype</code>. Two methods match if they have the same arity.
 * If a primop is overloaded then the "closest match" is returned. The
 * first entry in the vector of primops that has the right arity is
 * considered to be the default one.
 */
public MethodType lookupPrimop(SymbolTable stable, String op,
                               MethodType ctype) {
    MethodType result = null;
    final Vector primop = stable.lookupPrimop(op);
    if (primop != null) {
        final int n = primop.size();
        int minDistance = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            final MethodType ptype = (MethodType) primop.elementAt(i);
            // Skip if different arity
            if (ptype.argsCount() != ctype.argsCount()) {
                continue;
            }

            // The first method with the right arity is the default
            if (result == null) {
                result = ptype;             // default method
            }

            // Check if better than last one found
            final int distance = ctype.distanceTo(ptype);
            if (distance < minDistance) {
                minDistance = distance;
                result = ptype;
            }
        }
    }
    return result;
}
 
Example 6
Source File: Expression.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Search for a primop in the symbol table that matches the method type
 * <code>ctype</code>. Two methods match if they have the same arity.
 * If a primop is overloaded then the "closest match" is returned. The
 * first entry in the vector of primops that has the right arity is
 * considered to be the default one.
 */
public MethodType lookupPrimop(SymbolTable stable, String op,
                               MethodType ctype) {
    MethodType result = null;
    final Vector primop = stable.lookupPrimop(op);
    if (primop != null) {
        final int n = primop.size();
        int minDistance = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            final MethodType ptype = (MethodType) primop.elementAt(i);
            // Skip if different arity
            if (ptype.argsCount() != ctype.argsCount()) {
                continue;
            }

            // The first method with the right arity is the default
            if (result == null) {
                result = ptype;             // default method
            }

            // Check if better than last one found
            final int distance = ctype.distanceTo(ptype);
            if (distance < minDistance) {
                minDistance = distance;
                result = ptype;
            }
        }
    }
    return result;
}
 
Example 7
Source File: Expression.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Search for a primop in the symbol table that matches the method type
 * <code>ctype</code>. Two methods match if they have the same arity.
 * If a primop is overloaded then the "closest match" is returned. The
 * first entry in the vector of primops that has the right arity is
 * considered to be the default one.
 */
public MethodType lookupPrimop(SymbolTable stable, String op,
                               MethodType ctype) {
    MethodType result = null;
    final List<MethodType> primop = stable.lookupPrimop(op);
    if (primop != null) {
        final int n = primop.size();
        int minDistance = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            final MethodType ptype = primop.get(i);
            // Skip if different arity
            if (ptype.argsCount() != ctype.argsCount()) {
                continue;
            }

            // The first method with the right arity is the default
            if (result == null) {
                result = ptype;             // default method
            }

            // Check if better than last one found
            final int distance = ctype.distanceTo(ptype);
            if (distance < minDistance) {
                minDistance = distance;
                result = ptype;
            }
        }
    }
    return result;
}
 
Example 8
Source File: Expression.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Search for a primop in the symbol table that matches the method type
 * <code>ctype</code>. Two methods match if they have the same arity.
 * If a primop is overloaded then the "closest match" is returned. The
 * first entry in the vector of primops that has the right arity is
 * considered to be the default one.
 */
public MethodType lookupPrimop(SymbolTable stable, String op,
                               MethodType ctype) {
    MethodType result = null;
    final Vector primop = stable.lookupPrimop(op);
    if (primop != null) {
        final int n = primop.size();
        int minDistance = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            final MethodType ptype = (MethodType) primop.elementAt(i);
            // Skip if different arity
            if (ptype.argsCount() != ctype.argsCount()) {
                continue;
            }

            // The first method with the right arity is the default
            if (result == null) {
                result = ptype;             // default method
            }

            // Check if better than last one found
            final int distance = ctype.distanceTo(ptype);
            if (distance < minDistance) {
                minDistance = distance;
                result = ptype;
            }
        }
    }
    return result;
}
 
Example 9
Source File: Expression.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Search for a primop in the symbol table that matches the method type
 * <code>ctype</code>. Two methods match if they have the same arity.
 * If a primop is overloaded then the "closest match" is returned. The
 * first entry in the vector of primops that has the right arity is
 * considered to be the default one.
 */
public MethodType lookupPrimop(SymbolTable stable, String op,
                               MethodType ctype) {
    MethodType result = null;
    final Vector primop = stable.lookupPrimop(op);
    if (primop != null) {
        final int n = primop.size();
        int minDistance = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            final MethodType ptype = (MethodType) primop.elementAt(i);
            // Skip if different arity
            if (ptype.argsCount() != ctype.argsCount()) {
                continue;
            }

            // The first method with the right arity is the default
            if (result == null) {
                result = ptype;             // default method
            }

            // Check if better than last one found
            final int distance = ctype.distanceTo(ptype);
            if (distance < minDistance) {
                minDistance = distance;
                result = ptype;
            }
        }
    }
    return result;
}
 
Example 10
Source File: Expression.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Search for a primop in the symbol table that matches the method type
 * <code>ctype</code>. Two methods match if they have the same arity.
 * If a primop is overloaded then the "closest match" is returned. The
 * first entry in the vector of primops that has the right arity is
 * considered to be the default one.
 */
public MethodType lookupPrimop(SymbolTable stable, String op,
                               MethodType ctype) {
    MethodType result = null;
    final Vector primop = stable.lookupPrimop(op);
    if (primop != null) {
        final int n = primop.size();
        int minDistance = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            final MethodType ptype = (MethodType) primop.elementAt(i);
            // Skip if different arity
            if (ptype.argsCount() != ctype.argsCount()) {
                continue;
            }

            // The first method with the right arity is the default
            if (result == null) {
                result = ptype;             // default method
            }

            // Check if better than last one found
            final int distance = ctype.distanceTo(ptype);
            if (distance < minDistance) {
                minDistance = distance;
                result = ptype;
            }
        }
    }
    return result;
}
 
Example 11
Source File: Expression.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Search for a primop in the symbol table that matches the method type
 * <code>ctype</code>. Two methods match if they have the same arity.
 * If a primop is overloaded then the "closest match" is returned. The
 * first entry in the vector of primops that has the right arity is
 * considered to be the default one.
 */
public MethodType lookupPrimop(SymbolTable stable, String op,
                               MethodType ctype) {
    MethodType result = null;
    final Vector primop = stable.lookupPrimop(op);
    if (primop != null) {
        final int n = primop.size();
        int minDistance = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            final MethodType ptype = (MethodType) primop.elementAt(i);
            // Skip if different arity
            if (ptype.argsCount() != ctype.argsCount()) {
                continue;
            }

            // The first method with the right arity is the default
            if (result == null) {
                result = ptype;             // default method
            }

            // Check if better than last one found
            final int distance = ctype.distanceTo(ptype);
            if (distance < minDistance) {
                minDistance = distance;
                result = ptype;
            }
        }
    }
    return result;
}