com.sun.org.apache.xpath.internal.functions.Function Java Examples

The following examples show how to use com.sun.org.apache.xpath.internal.functions.Function. 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: FuncLoader.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get a Function instance that this instance is liaisoning for.
 *
 * @return non-null reference to Function derivative.
 *
 * @throws javax.xml.transform.TransformerException if ClassNotFoundException,
 *    IllegalAccessException, or InstantiationException is thrown.
 */
Function getFunction() throws TransformerException
{
  try
  {
    String className = m_funcName;
    if (className.indexOf(".") < 0) {
      className = "com.sun.org.apache.xpath.internal.functions." + className;
    }
    //hack for loading only built-in function classes.
    String subString = className.substring(0,className.lastIndexOf('.'));
    if(!(subString.equals ("com.sun.org.apache.xalan.internal.templates") ||
         subString.equals ("com.sun.org.apache.xpath.internal.functions"))) {
          throw new TransformerException("Application can't install his own xpath function.");
    }

    return (Function) ObjectFactory.newInstance(className, true);

  }
  catch (ConfigurationError e)
  {
    throw new TransformerException(e.getException());
  }
}
 
Example #2
Source File: FunctionTable.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Obtain a new Function object from a function ID.
 *
 * @param which  The function ID, which may correspond to one of the FUNC_XXX
 *    values found in {@link com.sun.org.apache.xpath.internal.compiler.FunctionTable}, but may
 *    be a value installed by an external module.
 *
 * @return a a new Function instance.
 *
 * @throws javax.xml.transform.TransformerException if ClassNotFoundException,
 *    IllegalAccessException, or InstantiationException is thrown.
 */
Function getFunction(int which)
        throws javax.xml.transform.TransformerException
{
        try{
            if (which < NUM_BUILT_IN_FUNCS) {
                return (Function) m_functions[which].getConstructor().newInstance();
            } else {
                Class<?> c =  m_functions_customer[which-NUM_BUILT_IN_FUNCS];
                return (Function) c.getConstructor().newInstance();
            }
        }catch (InstantiationException | IllegalAccessException | SecurityException |
            IllegalArgumentException | InvocationTargetException | NoSuchMethodException ex){
            throw new TransformerException(ex.getMessage());
        }
}
 
Example #3
Source File: FuncLoader.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get a Function instance that this instance is liaisoning for.
 *
 * @return non-null reference to Function derivative.
 *
 * @throws javax.xml.transform.TransformerException if ClassNotFoundException,
 *    IllegalAccessException, or InstantiationException is thrown.
 */
Function getFunction() throws TransformerException
{
  try
  {
    String className = m_funcName;
    if (className.indexOf(".") < 0) {
      className = "com.sun.org.apache.xpath.internal.functions." + className;
    }
    //hack for loading only built-in function classes.
    String subString = className.substring(0,className.lastIndexOf('.'));
    if(!(subString.equals ("com.sun.org.apache.xalan.internal.templates") ||
         subString.equals ("com.sun.org.apache.xpath.internal.functions"))) {
          throw new TransformerException("Application can't install his own xpath function.");
    }

    return (Function) ObjectFactory.newInstance(className, true);

  }
  catch (ConfigurationError e)
  {
    throw new TransformerException(e.getException());
  }
}
 
Example #4
Source File: FuncLoader.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Get a Function instance that this instance is liaisoning for.
 *
 * @return non-null reference to Function derivative.
 *
 * @throws javax.xml.transform.TransformerException if ClassNotFoundException,
 *    IllegalAccessException, or InstantiationException is thrown.
 */
Function getFunction() throws TransformerException
{
  try
  {
    String className = m_funcName;
    if (className.indexOf(".") < 0) {
      className = "com.sun.org.apache.xpath.internal.functions." + className;
    }
    //hack for loading only built-in function classes.
    String subString = className.substring(0,className.lastIndexOf('.'));
    if(!(subString.equals ("com.sun.org.apache.xalan.internal.templates") ||
         subString.equals ("com.sun.org.apache.xpath.internal.functions"))) {
          throw new TransformerException("Application can't install his own xpath function.");
    }

    return (Function) ObjectFactory.newInstance(className, true);

  }
  catch (ConfigurationError e)
  {
    throw new TransformerException(e.getException());
  }
}
 
Example #5
Source File: FuncLoader.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get a Function instance that this instance is liaisoning for.
 *
 * @return non-null reference to Function derivative.
 *
 * @throws javax.xml.transform.TransformerException if ClassNotFoundException,
 *    IllegalAccessException, or InstantiationException is thrown.
 */
Function getFunction() throws TransformerException
{
  try
  {
    String className = m_funcName;
    if (className.indexOf(".") < 0) {
      className = "com.sun.org.apache.xpath.internal.functions." + className;
    }
    //hack for loading only built-in function classes.
    String subString = className.substring(0,className.lastIndexOf('.'));
    if(!(subString.equals ("com.sun.org.apache.xalan.internal.templates") ||
         subString.equals ("com.sun.org.apache.xpath.internal.functions"))) {
          throw new TransformerException("Application can't install his own xpath function.");
    }

    return (Function) ObjectFactory.newInstance(className, true);

  }
  catch (ConfigurationError e)
  {
    throw new TransformerException(e.getException());
  }
}
 
Example #6
Source File: FuncLoader.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Get a Function instance that this instance is liaisoning for.
 *
 * @return non-null reference to Function derivative.
 *
 * @throws javax.xml.transform.TransformerException if ClassNotFoundException,
 *    IllegalAccessException, or InstantiationException is thrown.
 */
Function getFunction() throws TransformerException
{
  try
  {
    String className = m_funcName;
    if (className.indexOf(".") < 0) {
      className = "com.sun.org.apache.xpath.internal.functions." + className;
    }
    //hack for loading only built-in function classes.
    String subString = className.substring(0,className.lastIndexOf('.'));
    if(!(subString.equals ("com.sun.org.apache.xalan.internal.templates") ||
         subString.equals ("com.sun.org.apache.xpath.internal.functions"))) {
          throw new TransformerException("Application can't install his own xpath function.");
    }

    return (Function) ObjectFactory.newInstance(className, true);

  }
  catch (ConfigurationError e)
  {
    throw new TransformerException(e.getException());
  }
}
 
Example #7
Source File: FuncLoader.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get a Function instance that this instance is liaisoning for.
 *
 * @return non-null reference to Function derivative.
 *
 * @throws javax.xml.transform.TransformerException if ClassNotFoundException,
 *    IllegalAccessException, or InstantiationException is thrown.
 */
Function getFunction() throws TransformerException
{
  try
  {
    String className = m_funcName;
    if (className.indexOf(".") < 0) {
      className = "com.sun.org.apache.xpath.internal.functions." + className;
    }
    //hack for loading only built-in function classes.
    String subString = className.substring(0,className.lastIndexOf('.'));
    if(!(subString.equals ("com.sun.org.apache.xalan.internal.templates") ||
         subString.equals ("com.sun.org.apache.xpath.internal.functions"))) {
          throw new TransformerException("Application can't install his own xpath function.");
    }

    return (Function) ObjectFactory.newInstance(className, true);

  }
  catch (ConfigurationError e)
  {
    throw new TransformerException(e.getException());
  }
}
 
Example #8
Source File: FuncLoader.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get a Function instance that this instance is liaisoning for.
 *
 * @return non-null reference to Function derivative.
 *
 * @throws javax.xml.transform.TransformerException if ClassNotFoundException,
 *    IllegalAccessException, or InstantiationException is thrown.
 */
Function getFunction() throws TransformerException
{
  try
  {
    String className = m_funcName;
    if (className.indexOf(".") < 0) {
      className = "com.sun.org.apache.xpath.internal.functions." + className;
    }
    //hack for loading only built-in function classes.
    String subString = className.substring(0,className.lastIndexOf('.'));
    if(!(subString.equals ("com.sun.org.apache.xalan.internal.templates") ||
         subString.equals ("com.sun.org.apache.xpath.internal.functions"))) {
          throw new TransformerException("Application can't install his own xpath function.");
    }

    return (Function) ObjectFactory.newInstance(className, true);

  }
  catch (ConfigurationError e)
  {
    throw new TransformerException(e.getException());
  }
}
 
Example #9
Source File: FuncLoader.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get a Function instance that this instance is liaisoning for.
 *
 * @return non-null reference to Function derivative.
 *
 * @throws javax.xml.transform.TransformerException if ClassNotFoundException,
 *    IllegalAccessException, or InstantiationException is thrown.
 */
Function getFunction() throws TransformerException
{
  try
  {
    String className = m_funcName;
    if (className.indexOf(".") < 0) {
      className = "com.sun.org.apache.xpath.internal.functions." + className;
    }
    //hack for loading only built-in function classes.
    String subString = className.substring(0,className.lastIndexOf('.'));
    if(!(subString.equals ("com.sun.org.apache.xalan.internal.templates") ||
         subString.equals ("com.sun.org.apache.xpath.internal.functions"))) {
          throw new TransformerException("Application can't install his own xpath function.");
    }

    return (Function) ObjectFactory.newInstance(className, true);

  }
  catch (ConfigurationError e)
  {
    throw new TransformerException(e.getException());
  }
}
 
Example #10
Source File: FuncLoader.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get a Function instance that this instance is liaisoning for.
 *
 * @return non-null reference to Function derivative.
 *
 * @throws javax.xml.transform.TransformerException if ClassNotFoundException,
 *    IllegalAccessException, or InstantiationException is thrown.
 */
Function getFunction() throws TransformerException
{
  try
  {
    String className = m_funcName;
    if (className.indexOf(".") < 0) {
      className = "com.sun.org.apache.xpath.internal.functions." + className;
    }
    //hack for loading only built-in function classes.
    String subString = className.substring(0,className.lastIndexOf('.'));
    if(!(subString.equals ("com.sun.org.apache.xalan.internal.templates") ||
         subString.equals ("com.sun.org.apache.xpath.internal.functions"))) {
          throw new TransformerException("Application can't install his own xpath function.");
    }

    return (Function) ObjectFactory.newInstance(className, true);

  }
  catch (ConfigurationError e)
  {
    throw new TransformerException(e.getException());
  }
}
 
Example #11
Source File: FuncLoader.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Get a Function instance that this instance is liaisoning for.
 *
 * @return non-null reference to Function derivative.
 *
 * @throws javax.xml.transform.TransformerException if ClassNotFoundException,
 *    IllegalAccessException, or InstantiationException is thrown.
 */
Function getFunction() throws TransformerException
{
  try
  {
    String className = m_funcName;
    if (className.indexOf(".") < 0) {
      className = "com.sun.org.apache.xpath.internal.functions." + className;
    }
    //hack for loading only built-in function classes.
    String subString = className.substring(0,className.lastIndexOf('.'));
    if(!(subString.equals ("com.sun.org.apache.xalan.internal.templates") ||
         subString.equals ("com.sun.org.apache.xpath.internal.functions"))) {
          throw new TransformerException("Application can't install his own xpath function.");
    }

    return (Function) ObjectFactory.newInstance(className, true);

  }
  catch (ConfigurationError e)
  {
    throw new TransformerException(e.getException());
  }
}
 
Example #12
Source File: FuncLoader.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get a Function instance that this instance is liaisoning for.
 *
 * @return non-null reference to Function derivative.
 *
 * @throws javax.xml.transform.TransformerException if ClassNotFoundException,
 *    IllegalAccessException, or InstantiationException is thrown.
 */
Function getFunction() throws TransformerException
{
  try
  {
    String className = m_funcName;
    if (className.indexOf(".") < 0) {
      className = "com.sun.org.apache.xpath.internal.functions." + className;
    }
    //hack for loading only built-in function classes.
    String subString = className.substring(0,className.lastIndexOf('.'));
    if(!(subString.equals ("com.sun.org.apache.xalan.internal.templates") ||
         subString.equals ("com.sun.org.apache.xpath.internal.functions"))) {
          throw new TransformerException("Application can't install his own xpath function.");
    }

    return (Function) ObjectFactory.newInstance(className, true);

  }
  catch (ConfigurationError e)
  {
    throw new TransformerException(e.getException());
  }
}
 
Example #13
Source File: HasPositionalPredChecker.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Visit a function.
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param func The function reference object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitFunction(ExpressionOwner owner, Function func)
{
        if((func instanceof FuncPosition) ||
           (func instanceof FuncLast))
                m_hasPositionalPred = true;
        return true;
}
 
Example #14
Source File: HasPositionalPredChecker.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Visit a predicate within a location path.  Note that there isn't a
 * proper unique component for predicates, and that the expression will
 * be called also for whatever type Expression is.
 *
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param pred The predicate object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitPredicate(ExpressionOwner owner, Expression pred)
{
  m_predDepth++;

  if(m_predDepth == 1)
  {
    if((pred instanceof Variable) ||
       (pred instanceof XNumber) ||
       (pred instanceof Div) ||
       (pred instanceof Plus) ||
       (pred instanceof Minus) ||
       (pred instanceof Mod) ||
       (pred instanceof Quo) ||
       (pred instanceof Mult) ||
       (pred instanceof com.sun.org.apache.xpath.internal.operations.Number) ||
       (pred instanceof Function))
        m_hasPositionalPred = true;
    else
      pred.callVisitors(owner, this);
  }

  m_predDepth--;

  // Don't go have the caller go any further down the subtree.
  return false;
}
 
Example #15
Source File: HasPositionalPredChecker.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Visit a predicate within a location path.  Note that there isn't a
 * proper unique component for predicates, and that the expression will
 * be called also for whatever type Expression is.
 *
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param pred The predicate object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitPredicate(ExpressionOwner owner, Expression pred)
{
  m_predDepth++;

  if(m_predDepth == 1)
  {
    if((pred instanceof Variable) ||
       (pred instanceof XNumber) ||
       (pred instanceof Div) ||
       (pred instanceof Plus) ||
       (pred instanceof Minus) ||
       (pred instanceof Mod) ||
       (pred instanceof Quo) ||
       (pred instanceof Mult) ||
       (pred instanceof com.sun.org.apache.xpath.internal.operations.Number) ||
       (pred instanceof Function))
        m_hasPositionalPred = true;
    else
      pred.callVisitors(owner, this);
  }

  m_predDepth--;

  // Don't go have the caller go any further down the subtree.
  return false;
}
 
Example #16
Source File: HasPositionalPredChecker.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Visit a function.
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param func The function reference object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitFunction(ExpressionOwner owner, Function func)
{
        if((func instanceof FuncPosition) ||
           (func instanceof FuncLast))
                m_hasPositionalPred = true;
        return true;
}
 
Example #17
Source File: HasPositionalPredChecker.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Visit a function.
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param func The function reference object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitFunction(ExpressionOwner owner, Function func)
{
        if((func instanceof FuncPosition) ||
           (func instanceof FuncLast))
                m_hasPositionalPred = true;
        return true;
}
 
Example #18
Source File: HasPositionalPredChecker.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Visit a function.
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param func The function reference object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitFunction(ExpressionOwner owner, Function func)
{
        if((func instanceof FuncPosition) ||
           (func instanceof FuncLast))
                m_hasPositionalPred = true;
        return true;
}
 
Example #19
Source File: HasPositionalPredChecker.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Visit a predicate within a location path.  Note that there isn't a
 * proper unique component for predicates, and that the expression will
 * be called also for whatever type Expression is.
 *
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param pred The predicate object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitPredicate(ExpressionOwner owner, Expression pred)
{
  m_predDepth++;

  if(m_predDepth == 1)
  {
    if((pred instanceof Variable) ||
       (pred instanceof XNumber) ||
       (pred instanceof Div) ||
       (pred instanceof Plus) ||
       (pred instanceof Minus) ||
       (pred instanceof Mod) ||
       (pred instanceof Quo) ||
       (pred instanceof Mult) ||
       (pred instanceof com.sun.org.apache.xpath.internal.operations.Number) ||
       (pred instanceof Function))
        m_hasPositionalPred = true;
    else
      pred.callVisitors(owner, this);
  }

  m_predDepth--;

  // Don't go have the caller go any further down the subtree.
  return false;
}
 
Example #20
Source File: HasPositionalPredChecker.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Visit a predicate within a location path.  Note that there isn't a
 * proper unique component for predicates, and that the expression will
 * be called also for whatever type Expression is.
 *
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param pred The predicate object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitPredicate(ExpressionOwner owner, Expression pred)
{
  m_predDepth++;

  if(m_predDepth == 1)
  {
    if((pred instanceof Variable) ||
       (pred instanceof XNumber) ||
       (pred instanceof Div) ||
       (pred instanceof Plus) ||
       (pred instanceof Minus) ||
       (pred instanceof Mod) ||
       (pred instanceof Quo) ||
       (pred instanceof Mult) ||
       (pred instanceof com.sun.org.apache.xpath.internal.operations.Number) ||
       (pred instanceof Function))
        m_hasPositionalPred = true;
    else
      pred.callVisitors(owner, this);
  }

  m_predDepth--;

  // Don't go have the caller go any further down the subtree.
  return false;
}
 
Example #21
Source File: FunctionTable.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Install a built-in function.
 * @param name The unqualified name of the function, must not be null
 * @param func A Implementation of an XPath Function object.
 * @return the position of the function in the internal index.
 */
public int installFunction(String name, Class<?> func)
{

  int funcIndex;
  Integer funcIndexObj = getFunctionID(name);

  if (func != null && !Function.class.isAssignableFrom(func)) {
      throw new ClassCastException(func.getName()
                + " cannot be cast to "
                + Function.class.getName());
  }

  if (null != funcIndexObj)
  {
    funcIndex = funcIndexObj;

    if (funcIndex < NUM_BUILT_IN_FUNCS){
            funcIndex = m_funcNextFreeIndex++;
            m_functionID_customer.put(name, funcIndex);
    }
    m_functions_customer[funcIndex - NUM_BUILT_IN_FUNCS] = func;
  }
  else
  {
          funcIndex = m_funcNextFreeIndex++;
          m_functions_customer[funcIndex-NUM_BUILT_IN_FUNCS] = func;
          m_functionID_customer.put(name, funcIndex);
  }
  return funcIndex;
}
 
Example #22
Source File: HasPositionalPredChecker.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Visit a function.
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param func The function reference object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitFunction(ExpressionOwner owner, Function func)
{
        if((func instanceof FuncPosition) ||
           (func instanceof FuncLast))
                m_hasPositionalPred = true;
        return true;
}
 
Example #23
Source File: HasPositionalPredChecker.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Visit a predicate within a location path.  Note that there isn't a
 * proper unique component for predicates, and that the expression will
 * be called also for whatever type Expression is.
 *
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param pred The predicate object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitPredicate(ExpressionOwner owner, Expression pred)
{
  m_predDepth++;

  if(m_predDepth == 1)
  {
    if((pred instanceof Variable) ||
       (pred instanceof XNumber) ||
       (pred instanceof Div) ||
       (pred instanceof Plus) ||
       (pred instanceof Minus) ||
       (pred instanceof Mod) ||
       (pred instanceof Quo) ||
       (pred instanceof Mult) ||
       (pred instanceof com.sun.org.apache.xpath.internal.operations.Number) ||
       (pred instanceof Function))
        m_hasPositionalPred = true;
    else
      pred.callVisitors(owner, this);
  }

  m_predDepth--;

  // Don't go have the caller go any further down the subtree.
  return false;
}
 
Example #24
Source File: FunctionTable.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Install a built-in function.
 * @param name The unqualified name of the function, must not be null
 * @param func A Implementation of an XPath Function object.
 * @return the position of the function in the internal index.
 */
public int installFunction(String name, Class func)
{

  int funcIndex;
  Object funcIndexObj = getFunctionID(name);

  if (func != null && !Function.class.isAssignableFrom(func)) {
      throw new ClassCastException(func.getName()
                + " cannot be cast to "
                + Function.class.getName());
  }

  if (null != funcIndexObj)
  {
    funcIndex = ((Integer) funcIndexObj).intValue();

    if (funcIndex < NUM_BUILT_IN_FUNCS){
            funcIndex = m_funcNextFreeIndex++;
            m_functionID_customer.put(name, new Integer(funcIndex));
    }
    m_functions_customer[funcIndex - NUM_BUILT_IN_FUNCS] = func;
  }
  else
  {
          funcIndex = m_funcNextFreeIndex++;

          m_functions_customer[funcIndex-NUM_BUILT_IN_FUNCS] = func;

          m_functionID_customer.put(name,
              new Integer(funcIndex));
  }
  return funcIndex;
}
 
Example #25
Source File: HasPositionalPredChecker.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Visit a function.
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param func The function reference object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitFunction(ExpressionOwner owner, Function func)
{
        if((func instanceof FuncPosition) ||
           (func instanceof FuncLast))
                m_hasPositionalPred = true;
        return true;
}
 
Example #26
Source File: HasPositionalPredChecker.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Visit a predicate within a location path.  Note that there isn't a
 * proper unique component for predicates, and that the expression will
 * be called also for whatever type Expression is.
 *
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param pred The predicate object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitPredicate(ExpressionOwner owner, Expression pred)
{
  m_predDepth++;

  if(m_predDepth == 1)
  {
    if((pred instanceof Variable) ||
       (pred instanceof XNumber) ||
       (pred instanceof Div) ||
       (pred instanceof Plus) ||
       (pred instanceof Minus) ||
       (pred instanceof Mod) ||
       (pred instanceof Quo) ||
       (pred instanceof Mult) ||
       (pred instanceof com.sun.org.apache.xpath.internal.operations.Number) ||
       (pred instanceof Function))
        m_hasPositionalPred = true;
    else
      pred.callVisitors(owner, this);
  }

  m_predDepth--;

  // Don't go have the caller go any further down the subtree.
  return false;
}
 
Example #27
Source File: HasPositionalPredChecker.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Visit a function.
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param func The function reference object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitFunction(ExpressionOwner owner, Function func)
{
        if((func instanceof FuncPosition) ||
           (func instanceof FuncLast))
                m_hasPositionalPred = true;
        return true;
}
 
Example #28
Source File: HasPositionalPredChecker.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Visit a predicate within a location path.  Note that there isn't a
 * proper unique component for predicates, and that the expression will
 * be called also for whatever type Expression is.
 *
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param pred The predicate object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitPredicate(ExpressionOwner owner, Expression pred)
{
  m_predDepth++;

  if(m_predDepth == 1)
  {
    if((pred instanceof Variable) ||
       (pred instanceof XNumber) ||
       (pred instanceof Div) ||
       (pred instanceof Plus) ||
       (pred instanceof Minus) ||
       (pred instanceof Mod) ||
       (pred instanceof Quo) ||
       (pred instanceof Mult) ||
       (pred instanceof com.sun.org.apache.xpath.internal.operations.Number) ||
       (pred instanceof Function))
        m_hasPositionalPred = true;
    else
      pred.callVisitors(owner, this);
  }

  m_predDepth--;

  // Don't go have the caller go any further down the subtree.
  return false;
}
 
Example #29
Source File: HasPositionalPredChecker.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Visit a function.
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param func The function reference object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitFunction(ExpressionOwner owner, Function func)
{
        if((func instanceof FuncPosition) ||
           (func instanceof FuncLast))
                m_hasPositionalPred = true;
        return true;
}
 
Example #30
Source File: HasPositionalPredChecker.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Visit a predicate within a location path.  Note that there isn't a
 * proper unique component for predicates, and that the expression will
 * be called also for whatever type Expression is.
 *
 * @param owner The owner of the expression, to which the expression can
 *              be reset if rewriting takes place.
 * @param pred The predicate object.
 * @return true if the sub expressions should be traversed.
 */
public boolean visitPredicate(ExpressionOwner owner, Expression pred)
{
  m_predDepth++;

  if(m_predDepth == 1)
  {
    if((pred instanceof Variable) ||
       (pred instanceof XNumber) ||
       (pred instanceof Div) ||
       (pred instanceof Plus) ||
       (pred instanceof Minus) ||
       (pred instanceof Mod) ||
       (pred instanceof Quo) ||
       (pred instanceof Mult) ||
       (pred instanceof com.sun.org.apache.xpath.internal.operations.Number) ||
       (pred instanceof Function))
        m_hasPositionalPred = true;
    else
      pred.callVisitors(owner, this);
  }

  m_predDepth--;

  // Don't go have the caller go any further down the subtree.
  return false;
}