Class FilterExpression

java.lang.Object
org.apache.hadoop.fs.shell.find.FilterExpression
All Implemented Interfaces:
Configurable, Expression

public abstract class FilterExpression extends Object implements Expression, Configurable
Provides an abstract composition filter for the Expression interface. Allows other Expression implementations to be reused without inheritance.
  • Field Details

  • Constructor Details

    • FilterExpression

      protected FilterExpression(Expression expression)
  • Method Details

    • setOptions

      public void setOptions(FindOptions options) throws IOException
      Description copied from interface: Expression
      Set the options for this expression, called once before processing any items.
      Specified by:
      setOptions in interface Expression
      Parameters:
      options - options.
      Throws:
      IOException - raised on errors performing I/O.
    • prepare

      public void prepare() throws IOException
      Description copied from interface: Expression
      Prepares the expression for execution, called once after setting options and before processing any options.
      Specified by:
      prepare in interface Expression
      Throws:
      IOException - raised on errors performing I/O.
    • apply

      public Result apply(PathData item, int depth) throws IOException
      Description copied from interface: Expression
      Apply the expression to the specified item, called once for each item.
      Specified by:
      apply in interface Expression
      Parameters:
      item - PathData item to be processed
      depth - distance of the item from the command line argument
      Returns:
      Result of applying the expression to the item
      Throws:
      IOException - raised on errors performing I/O.
    • finish

      public void finish() throws IOException
      Description copied from interface: Expression
      Finishes the expression, called once after processing all items.
      Specified by:
      finish in interface Expression
      Throws:
      IOException - raised on errors performing I/O.
    • getUsage

      public String[] getUsage()
      Description copied from interface: Expression
      Returns brief usage instructions for this expression. Multiple items should be returned if there are multiple ways to use this expression.
      Specified by:
      getUsage in interface Expression
      Returns:
      array of usage instructions
    • getHelp

      public String[] getHelp()
      Description copied from interface: Expression
      Returns a description of the expression for use in help. Multiple lines should be returned array items. Lines should be formated to 60 characters or less.
      Specified by:
      getHelp in interface Expression
      Returns:
      array of description lines
    • isAction

      public boolean isAction()
      Description copied from interface: Expression
      Indicates whether this expression performs an action, i.e. provides output back to the user.
      Specified by:
      isAction in interface Expression
      Returns:
      if is action true, not false.
    • isOperator

      public boolean isOperator()
      Description copied from interface: Expression
      Identifies the expression as an operator rather than a primary.
      Specified by:
      isOperator in interface Expression
      Returns:
      if is operator true, not false.
    • getPrecedence

      public int getPrecedence()
      Description copied from interface: Expression
      Returns the precedence of this expression (only applicable to operators).
      Specified by:
      getPrecedence in interface Expression
      Returns:
      precedence.
    • addChildren

      public void addChildren(Deque<Expression> expressions)
      Description copied from interface: Expression
      Adds children to this expression. Children are popped from the head of the deque.
      Specified by:
      addChildren in interface Expression
      Parameters:
      expressions - deque of expressions from which to take the children
    • addArguments

      public void addArguments(Deque<String> args)
      Description copied from interface: Expression
      Adds arguments to this expression. Arguments are popped from the head of the deque and added to the front of the child list, ie last child added is the first evaluated.
      Specified by:
      addArguments in interface Expression
      Parameters:
      args - deque of arguments from which to take expression arguments
    • setConf

      public void setConf(Configuration conf)
      Description copied from interface: Configurable
      Set the configuration to be used by this object.
      Specified by:
      setConf in interface Configurable
      Parameters:
      conf - configuration to be used
    • getConf

      public Configuration getConf()
      Description copied from interface: Configurable
      Return the configuration used by this object.
      Specified by:
      getConf in interface Configurable
      Returns:
      Configuration
    • toString

      public String toString()
      Overrides:
      toString in class Object